netdom join <SERVERNAME> /Domain:<DOMAINNAME> /UserD:<username> /PasswordD:* /reboot
The * means prompt for a password.
Example
Okay say you have a member server that has fallen off the domain, but you don’t want to go through the normal procedure of using “My Computer”->”Computer Name” and then disjoining to a WORKGROUP rebooting, then re-joining to the domain and rebooting again.
Note: You need to run this command from a domain controller, if you run it from the member server it won’t work.
Note: A Computer object must exist for the “remove” command to work.
netdom remove "servername" /d:domain /userd:<domainname>\<username> passwordd:<password> /userO:<local admin username> passwordO:<password></em>
The computer account in AD should now have a red x against it, ready for rejoining.
followed by the:
netdom join "servername" /d:domain /userd:<DOMAINNAME>\<USERNAME> passwordd:<PASSWORD> /userO:<local admin username> passwordO:<password> /OU:<destination OU> /reboot:10
The domain account should now be rejoined and the server will reboot after 10 seconds.