There are several ways to add a computer to domain. You can use either NetDom or Add-Computer PowerShell cmdlet. This tip explains how to add local computer to an Active Directory domain using Add-Computer PowerShell cmdlet.
First command adds local computer to the MyDomain.com domain and then restarts the computer.
- Add-Computer -DomainName MyDomain.com –Restart
- Add-Computer -DomainName MyDomain.com -Server MyDomain.com\DC1 -Passthru -Verbose
Second command adds the local computer to the MyDomain.com domain by using the MyDomain.com\DC1 domain controller. The command also uses the -PassThru and -Verbose parameters to get detailed information about the results of the command.
About Nirmal Sharma
Nirmal is a MCSEx3, MCITP and was awarded Microsoft MVP award in Directory Services. He is specialized in Directory Services, Microsoft Clustering, Hyper-V, SQL and Exchange and has been involved in Microsoft Technologies since 1994. In his spare time, he offers technical help by writing tips and articles. Nirmal can be reached at nirmal_sharma@mvps.org.