When remote desktop does not connect: changing Windows DNS setttings remotely

This was an annoying. I tried to remote desktop into my Hyper-V Server today and could not. The message:

Remote Desktop cannot verify the identity of the remote computer because there is a time or date difference between your computer and the remote computer.

image

Hmm. I typed:

net time \\myhypervbox

and it was the same as the time on my desktop.

A Google or two later, and I discovered that this message is caused by an incorrect DNS setting on the target computer. That made sense, since a DNS server died recently. I had changed the settings on the VMs but forgot to do it on the Hyper-V host. Thank you Microsoft for a misleading error message.

Of course my Hyper-V server has no screen attached. So how to change the DNS setting? Umm, not by remote desktop.

I fiddled with netsh for a bit. This looks promising, but it was not playing ball. I tried to list the interfaces and it gave an error saying it could not do so when remote access is not running. Further, I have two network cards in this machine, and Hyper-V creates virtual interfaces, and I was not sure what the correct network interface name was.

Next up was the registry editor. Run Regedit, choose File – Connect Network Registry. That worked. I went to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip\Parameters\Interfaces

This lists the network interfaces as GUIDs. I went through them one by one, and in the two cases where the NameServer entry was set to the dead server, I changed it to the new one.

There is also an entry for NameServer in the top level Parameters key but this was blank and I left it alone.

If you want to know what all these keys do, there is a guide here.

I rebooted the machine, remotely of course:

shutdown /m \\myhypervbox /r

and when it restarted remote desktop worked again.

8 thoughts on “When remote desktop does not connect: changing Windows DNS setttings remotely”

  1. >>Yes, but what will I have to write about

    the same thing, it will just be read by ‘someone else’ 😉

  2. Hmm, I’m going through the same thing.

    The problem is that all the keys are correct. What may be my mitigating factor is that I’m running the Hyper-V role, and I have multiple NICs. One of the NICs is Internet connected, and only used by a VM, so the DNS on that NIC doesn’t point to my DC.

    Rebooting the whole server (and all the VMs) every time it stops working is a sucky solution.

  3. Okay, I figured my problem out. Somehow, the “Share this NIC with the host OS” checkbox had gotten checked on a NIC that was meant only for a VM. The DNS from the other NIC was playing havoc.

    Whomever decided that it would be okay to just show a message about the time being out of sync should be whipped…

  4. For those of you experiencing this problem currently (like me) you may be able to connect to the remote server using the IP address.

Comments are closed.