#Join Windows 10 Professional To An Active Directory Domain Using PowerShell Direct
#These are the commands to rename a Windows 10 client computer to
GONZO and add that computer to a domain called
Rename-Computer -NewName GONZO -Verbose -PassThru #Rename computer before joining domain. Requires restart Restart-Computer Add-Computer -DomainName domain.muppetlabs.com -Credential domain\administrator -Passthru -Verbose #Join Active Directory Domain and add to Computer container. Requires restart Restart-Computer
#The Longer Story…
#Your computer may not need to be renamed so skip that if needed. Also the
Add-Computer command sends your newly added computers to the
Computers container by default unless you specify an
-OUPath when running
#Rename computer before joining your domain if your computer name doesn’t comply with server standards. Restart required.
Rename-Computer -NewName GONZO -Verbose -PassThru #Rename computer before joining domain. Requires restart Restart-Computer
#Join a domain called
domain.muppetlabs.com. Restart required.
#You need to change the
domain.muppetlabs.com to what you call your domain. Use
-Restart at the end of the
Add-Computer command to automatically restart.
Add-Computer -DomainName domain.muppetlabs.com -Credential domain\administrator -Passthru -Verbose #Join Active Directory Domain and add to Computer container. Requires restart Restart-Computer
#A Bit More
#Specify a preconfigured Organizational Unit path when joining domain
#My domain is simple and this is not needed for me at this time. I don’t have multiple Organizational Units yet and I don’t need any Group Policies affecting this PC since I’m working with my Windows 10 Creators Edition management PC. I’m able to specify the
-OUPath shown below, once I complete the step below to create an OU called
Producers. This command adds the computer to
#You are not able to specify another container besides the default
Computers container, but there is a way to change the default container if you don’t specify an OU. I definitely don’t want my computers added to the default OU which is
OU=Domain Controllers, so I don’t use this command switch unless I have created a new OU first. It has been suggested to create the OU and computer object prior to joining the domain, but I don’t need to do that at this point.
#The command below is used to specify an
Organizational Unit when joining a domain, if needed.
Add-Computer -DomainName 'domain.muppetlabs.com' -OUPath 'OU=Producers,DC=domain,DC=muppetlabs,DC=com' -Credential 'DOMAIN\administrator' -Passthru -Verbose Restart-Computer
#Create a new Organizational Unit on the server (Needs to be run on Windows Server 2016 with the Active Directory role installed and configured)
#If you preconfigure an alternative Organizational Unit on Windows Server 2016 then you can add your computers directly to that OU by specifying a
-OUPath when running
New-ADOrganizationalUnit -Name Producers -Description 'Administrator Rights' -DisplayName Producers -PassThru -Verbose