Join Computer to Domain with Desired Computer Name and OU

Step #1: This is the simplest method to add a computer to a domain. In this example you will be prompted for credentials followed by the required reboot.

Step #2: If you require an automated script without prompting the user for credentials you can provide the user account with rights to add computers to the domain.

Step #3: The following example shows how to specify the Organizational Unit in Active Directory where the computer account will reside.

Step #4: The following example highlights how you can add a computer to the domain as a new computer name without a reboot in between. Imaging processes may initially assign your computer a random name that requires changing to include a specific naming standard.

Step #5: The final example allows for input from the user to determine both the computer name and the Active Directory location. This utilizes Write-Host and Read-Host with a small amount of IF THEN validation to accomplish this. If someone does not enter any value it will use the Default value as displayed to the user. For the numbers 1-4 option if an invalid character is entered it will also use the specified Default setting.

join-domain

 

Step #6: The following is a Function example that can be used within a script or from a GUI compliments from a reader.

 

Enjoy!