Error: Domain Cannot Be Contacted

less than 1 minute read


I’ve seen this error recently in my Hyper-V lab when trying to a join a computer to my domain controller. I knew it was something to do with DNS, but here are the things I did in order to resolve.

To Resolve:

  1. Here are the commands I was running:

    # First, verify Subnet / Gateway.
    # Looks good, let's ping domain controller.
    Test-NetConnection server2012
    # Returns - good
    # Now ping the domain
    # No replies, dang it. Oh wait! Let's set the domain controller as the primary DNS server
    # Change settings in Network Connections
    # See interfaceIndex of 4 for my LAN NIC.
    Get-DnsClientServerAddress -InterfaceIndex 4 -AddressFamily IPv4
    # See that I'm pointing to my gateway as the primary DNS server - wrong!
    Set-DnsClientServerAddress -InterfaceIndex 4 -ServerAddresses ("","")
    # Ping again, dang it still fails! Wait, need to flush dns!
    # Returns domain name, good to go!
    # Now I can try to join again and it should work!
    Add-Computer -Domainname "" -Credential (Get-Credential) -Verbose
    # Success!