Skip to content
ohsudo, Home
Windows

Windows "The specified domain either does not exist or could not be contacted": it's usually DNS

Fix "The specified domain either does not exist or could not be contacted" when joining a domain: point DNS at a domain controller, test the SRV records, ports and time.

Intermediate4 min readApplies to Windows 10 · Windows 11 · Windows Server 2016+ · Active Directory

by OhSudo ··

The specified domain either does not exist or could not be contacted.

Or, in the longer version, when joining a domain:

An Active Directory Domain Controller (AD DC) for the domain "contoso.local" could not be contacted.

In nearly every case, this machine is asking the wrong DNS server. A computer finds a domain controller by asking DNS for special records. A public server like 8.8.8.8 has never heard of your internal domain, so to this machine, the domain doesn’t exist.

  1. This computerneeds a DC for contoso.local
  2. Its DNS server8.8.8.8 instead of your DC(breaks here)
  3. Domain controllernever found
A computer finds a domain controller by asking DNS for special records. A public DNS server has never heard of your internal domain, so to this machine it doesn't exist.

TL;DR

Terminal window
Get-DnsClientServerAddress -AddressFamily IPv4 # which DNS server?
nslookup -type=SRV _ldap._tcp.dc._msdcs.contoso.local
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10
ipconfig /flushdns

10.0.0.10 is your domain controller here. Set yours, then try again.

1. Which DNS server is it using?

Terminal window
Get-DnsClientServerAddress -AddressFamily IPv4
ipconfig /all

Machines in a domain must use the domain’s DNS servers, and only those. A home router, 8.8.8.8 or 1.1.1.1 won’t do. Don’t add a public server as “secondary” either: Windows may use it at any time, and then the domain seems to disappear now and then.

Set it, or fix it on your DHCP server if that’s where it comes from:

Terminal window
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10, 10.0.0.11
ipconfig /flushdns

Get-NetAdapter lists the names, if yours isn’t Ethernet.

2. Can it find a domain controller?

This is exactly the question Windows asks:

Terminal window
nslookup -type=SRV _ldap._tcp.dc._msdcs.contoso.local
_ldap._tcp.dc._msdcs.contoso.local SRV service location:
priority = 0
port = 389
svr hostname = dc01.contoso.local

Or use the dedicated tool, which also tests the answer:

Terminal window
nltest /dsgetdc:contoso.local

Check the domain’s full name: contoso.local, rather than the short name, CONTOSO. A short name needs extra lookups that often fail, so use the full one when joining.

  • Non-existent domain: a wrong DNS server (section 1), or a wrong name.
  • Can't find ... on the right server: the records are missing on the domain controller (section 4).

3. Can it reach the domain controller?

DNS answers, and joining needs the network too:

Terminal window
Test-NetConnection dc01.contoso.local -Port 389
Test-NetConnection dc01.contoso.local -Port 445
Test-NetConnection dc01.contoso.local -Port 88
Port For
53 DNS
88 Kerberos sign-in
135, plus 49152–65535 RPC
389 LDAP
445 SMB, for policies and scripts

A failure means a firewall in between, or a VPN that doesn’t carry this traffic. A VPN often gives you its own DNS server too, so check ipconfig /all while it’s connected. The Port Lookup explains these ports. If 135 passes and joining still fails, see The RPC server is unavailable.

4. On the domain controller

If records are missing, make the domain controller register them again:

Terminal window
Get-Service DNS, Netlogon, NTDS, KDC | Format-Table Name, Status
Restart-Service Netlogon
ipconfig /registerdns
dcdiag /test:dns /v

Check that the domain controller points to itself, or to another domain controller, for DNS. A domain controller set to use a public server breaks in the same way.

5. Check the time

Kerberos refuses sign-ins when clocks differ by more than 5 minutes, and the message can then be misleading. Compare them:

Terminal window
w32tm /stripchart /computer:dc01.contoso.local /samples:3 /dataonly

Fix it:

Terminal window
w32tm /config /syncfromflags:domhier /update
Restart-Service w32time
w32tm /resync

Virtual machines that were suspended, or restored from a snapshot, are the usual suspects.

6. Then try the join

Terminal window
Add-Computer -DomainName contoso.local -Credential CONTOSO\admin -Restart

The -Server dc01.contoso.local option can name a domain controller directly, which helps rule out problems with finding one.

A machine that’s already joined and suddenly shows this has probably lost its DNS settings, or its VPN. If it’s the machine’s own account that’s broken, the message is different: see the trust relationship failed.

Warning

Avoid editing the hosts file to point the domain at a server. It may let the join go through, but sign-ins need the SRV records, and problems come back later in ways that are much harder to trace. Fix DNS instead.

Shell, we have a problem!

Similar, but different: The trust relationship between this workstation and the primary domain failed means DNS works, and the machine’s account doesn’t: see that article. Access is denied when joining means the account can’t add computers. The network path was not found is a System error 53. Temporary failure in name resolution is the Linux version of a DNS problem.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Tools

Try it yourself

Articles

Related articles