Reset DNS Server to DHCP from the Command Line

If a user can’t access the internet because their DNS is static, you can’t connect remotely but you may be able to walk threm through entering a couple of commands (though you’ll need to provide an Adminstrator-level password). Thanks to this StackOverflow article for ideas. Note:  changing DNS can cause a computer to lose network connectivity. Use at  your own risk!

List interfaces:

netsh interface show interface

Check configuration of interface “Wi-Fi”, including its DNS configuration:

netsh interface ip show config "Wi-Fi"

Reset “Wi-Fi” to use DHCP for DNS:

netsh interface ip set dns "Wi-Fi" dhcp

Reset all enabled NICs to use DHCP for DNS:

wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder()

Note that the WMIC SetDNSServerSearchOrder() basically removes static settings, implying that DNS should be set via DHCP.

Windows Server Essentials 2016 Issue

The above condition may occur due to Essentials’ default behavior of setting a static DNS server in clients. I found some help on this here, which links to this as the primary Microsoft article. The key parts of “Feature 1” from that article:

  • To skip the automatic DNS detection on a client that is managed by Windows Server Essentials, run the following command on the client computer from an elevated command prompt:
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Server\Networking\ServerDiscovery" /v SkipAutoDNSServerDetection /t REG_SZ /d true
    Note If you want this functionality to be effective immediately, restart the Windows Server LAN Configuration service or the client computer.
  • You can also change the behavior of all clients that are managed by a Windows Server Essentials server. To do this, run the following command on the Windows Server Essentials server from an elevated command prompt:
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Server\Networking\ClientDns" /v SkipAutoDnsConfig /t REG_DWORD /d 1
    Note After this solution is applied, all clients that are connected to the Windows Server 2012 Essentials server skip the DNS configure feature. The existing clients that were connected to the Windows Server 2012 Essentials server before this change must reinstall the Connector and then reconnect to the Windows Server 2012 Essentials server.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.