How to join an Active Directory domain with PowerShell DSC
To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!
Hello,
Joining an Active Directory domain with PowerShell DSC
Presentation of different alternatives for joining an Active Directory domain:
How to join an Active Directory domain with System Properties (1/9)
Best domain joining practices - Delegation and pre-staging (2/9)
How to join an Active Directory domain using the Settings Menu (3/9)
How to join an Active Directory domain using PowerShell (4/9)
How to join an Active Directory domain with djoin (offline) (5/9)
How to join an Active Directory domain with netdom (6/9)
How to join an Active Directory domain with DSC (7/9)
How to join an Active Directory domain with ICD (8/9)
How to join an Active Directory domain with MDT (9/9)
PowerShell DSC code to join a domain
# Installing the DSC modules.$package = @( 'ComputerManagementdsc' )Install-Package $package -Force -Source psgallery# Identifiers for installing the domain and for DSRM$passwd = ConvertTo-SecureString 'P@ssword' -AsPlainText -Force$id = New-Object System.Management.Automation.PSCredential('domaine\tech1',$passwd)# Enable WinrmEnable-PSRemoting -Force -SkipNetworkProfileCheck# Authorise scriptsSet-ExecutionPolicy RemoteSigned -Force# DSC engine configuration[DSCLocalConfigurationManager()]LCMConfig configuration{ Node localhost { settings { ActionAfterReboot = 'ContinueConfiguration' ConfigurationMode = 'ApplyOnly' RebootNodeIfNeeded = $true } }}LCMConfigSet-DscLocalConfigurationManager -ComputerName localhost -Force -Verbose -path .\LCMConfig# To avoid errors when using identifiers in DSC$configData = @{ AllNodes = @( @{ NodeName = 'localhost'; PSDscAllowPlainTextPassword = $true } ) NonNodeData = $data }# Creating the DSC configurationDemo-Junction configuration{ param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)][string]$MachineName, [Parameter(Mandatory)][string]$DomainName, [Parameter(Mandatory)][string]$OU )
# Import DSC resources Import-DscResource -Module ComputerManagementDSC Node $NodeName { Computer NewNameAndWorkgroup { Name = $MachineName DomainName = $DomainName Credential = $id JoinOU = $OU } }}# Create the DSC configuration fileDemo-Junction -MachineName PC-DSC -DomainName domaine.tld -OU 'ou=computers,dc=domain,dc=tld' -ConfigurationData $configData# Application of the DSC fileStart-DscConfiguration -ComputerName localhost -Wait -Force -Verbose -path .\Demo-Junction -Debug
Video : How to join an Active Directory domain with PowerShell DSC
Related links
How to join an Active Directory domain with PowerShell DSC
Joining an Active Directory domain with PowerShell DSCPowershell - How to add and view a GPO description
How to add and view a GPO description in PowershellActive Directory - Viewing and protecting unprotected organizational units with Powershell
Active Directory - Viewing and protecting unprotected organizational units with PowershellPowershell - Testimo module for testing your Active Directory
Testimo is a PowerShell module designed to facilitate basic or more advanced testing of Active DirectoryPowershell - presentation of the GPOZaurr module for analysing your GPOs
The GPOZaurr module allows you to analyse your GPOs and also to modify or even delete themPowershell - AD As Built Report module overview
Microsoft AD As Built Report is a PowerShell module that works in conjunction with AsBuiltReport.Core to generate a report on your Active Directory
Follow me on
Support me
Last content
Powershell - Testing network connectivity and port accessibility
Powershell - Display network connections (equivalent to netstat)
Powershell - Testing name resolution (equivalent to nslookup)
Powershell - View and manage DNS configuration of network interfaces
Powershell - Managing IP configuration of network interfaces
Powershell - Managing the status and configuration of network interfaces
Powershell and the Left Hand Side
Powershell - Managing disks, partitions and volumes