Join Windows to Domain from the Command Line with CMD
-
Joining a domain from the command line is very important in the era of Server Core. With new server builds, likely you will have to do this regularly. The NETDOM JOIN command makes this very quick and simple. Using %computername% makes this even easier to do for the local machine where we will be performing the task nearly always.
NETDOM JOIN %computername% /domain:mydomain.com /userd:administrator /passwordd:secretstuff
If you want to perform this task on a remote machine simply replace %computername% with the name of the remote machine you wish to modify.
As always with domain joins, you must ensure that networking is set up correctly and DNS is resolving correctly before attempting to join.
Originally on my Windows administration blog circa 2013 here: http://web.archive.org/web/20130929034913/http://www.scottalanmiller.com/windows/2013/03/24/join-domain-from-the-command-line/