Joining a computer to the domain using PowerShell

Bumped into a problem where the user account used to join machines to the domain was limited to joining the machines to a particular OU. That makes it hard to just join a machine using the good old way i.e. System Properties and then joining the domain. This will not let me specify the OU to join and will fail and probably this is the intention with this design at this particular customer.

But anyway thanks to a great builtin PowerShell cmdlet in Windows 7 I could get the job done in seconds. Keep in mind :)

Add-Computer -DomainName -Credential\joinDomainAccount -OUPath "OU=Company,DC=contoso,DC=com"

Reference: Microsoft TechNet

Add a Comment