We are assuming that you are running PowerShell with elevated privileges and with an account that has the rights to join computers to domain.
Use the Add-Computer cmdlet.
I’m also adding the computer account to a child OU called WKS and the verbose parameter to get detailed information during the process.
Add-Computer –DomainName frenchitguy.com –OUPath “OU=WKS, OU=IT, OU=FR, DC=Frenchitguy, DC=com” –Credential frenchitguy.com\administrator –passthru –verbose
Enter the password and click yes.
See the result
Restart the computer now with shutdown /r
Your computer is on the domain now
Cheers.
Be the first to comment on "Add computer to domain using PowerShell"