joining a computer to a domain command line is something that without the introduction of server 2012 core, we need to start being aware how to make this all work.
Server Core has no System Properties dialog, and on any machine the command line is faster and scriptable. This guide uses netdom, the classic tool, and shows the PowerShell equivalent at the end.
Prerequisites
- The computer’s DNS server must be a domain controller (or a DNS server that can resolve your AD domain). This is the cause of most failed joins.
- A domain account allowed to join computers. By default any domain user can join up to 10 computers; administrators and delegated accounts can join more.
- Network access to a domain controller and clocks within a few minutes of each other, since Kerberos rejects large time differences.
netdomis part of the Windows Server command-line tools; on a desktop edition it comes with the Remote Server Administration Tools (RSAT).
Step 1: open an elevated prompt
if you have a computer that’s already setup and ready to go, open a command prompt or powershell window

Run it as Administrator. Joining changes the machine’s security settings and fails with access denied in a normal prompt.
Step 2: run netdom join
issue the following command (please modify for your AD Domain) the parts that you will need to customize is in bold
netdom join localhost /domain:myinternaldomain /userd:domainuseraccount /passwordd:S$uper$ecretP@ssw0rd
localhostis the computer being joined (you can also give a remote computer’s name)./domain:is the AD domain, ideally the full DNS name, such as corp.contoso.com./userd:and/passwordd:are the domain account and password used to create the computer account. Use/passwordd:*to be prompted instead of leaving the password in your command history.- Add
/ou:"OU=Servers,DC=corp,DC=contoso,DC=com"to create the computer account in a specific OU instead of the default Computers container.
In PowerShell, a $ in an unquoted password is read as a variable, so wrap the password in single quotes or use /passwordd:*.
you should see the following once joined to the domain:

Step 3: reboot
from there go ahead and reboot with the following command:
shutdown /r /t now
Note that /t expects a number of seconds, so the reliable form is:
shutdown /r /t 0
Verify the join
After the reboot, log in with a domain account and check:
systeminfo | findstr /B /C:"Domain"
nltest /dsgetdc:corp.contoso.com
The first line should show your AD domain instead of WORKGROUP, and nltest shows which domain controller answered. See Find out what domain controller you are authenticating with for more on that.
Troubleshooting
- “The specified domain either does not exist or could not be contacted”: DNS. Point the network adapter at a domain controller and test with
nslookup corp.contoso.com. - Access is denied: the account cannot create computer accounts (for example, it has hit the 10-computer limit) or the prompt is not elevated.
- A computer account with this name already exists: reset or delete the old account in Active Directory Users and Computers, or join with a different name.
The PowerShell way
On Windows Server 2012 and later, and Windows 8 and later, Add-Computer does the same job and prompts for the password:
Add-Computer -DomainName corp.contoso.com -Credential CORP\domainuseraccount -Restart
On Server Core you can also use sconfig option 1 (Domain/Workgroup), which walks you through the same join interactively.
Related guides: Install Server 2012 Core | Find out what domain controller you are authenticating with

2 Comments