Join Computer to Domain via Powershell

Join Computer to Domain

Joining a computer to domain via PowerShell is whole lot easier than regular way of GUI based.

To Join a Computer to domain,

Add-Computer -DomainName “HarmikBatth.Lab”

addcomputetrtodomain

Enter the user credentials, which has permission to join the computer to a domain.

You can also mention the “-Restart”, which will automatically restart the computer on successfully joining to domain.

Once the computer is restarted, it is joined to domain and you can login using domain credentials.

Join Computer to Domain in Specific OU

Above command by default will put this computer into Default Computers OU. if you have requirements to move or place this computer directly into specific OU, you can follow the below procedure to do so.

Add-Computer -DomainName HarmikBatth.Lab -OUPath OU=testOU,DC=domain,DC=Domain,DC=com

The local computer is added to the organizational unit (OU) in the directory that is specified by the OUPath parameter

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s