Add machine/computer to a Domain

Adding a machine to domain is easy task if its in single digit (Just Kidding). It can be time consuming and it can be come challenging in an environment where machine are built frequently

Powershell will make this task seamless with the script below.

Note: The Administrator should have appropriate access to run the script and to join the domain.

$domain = "Your Domain Name"
$password = "Password" | ConvertTo-SecureString -asPlainText -Force
$username = "$domain\Admin Account name" 
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
Add-Computer -DomainName $domain -Credential $credential -OUPath ' OU PATH '
Restart-Computer

Published by iamfazul

Author of the site

Leave a comment