Tip: Change DNS Server for a Network Adapter via Command Line in Windows

This article was posted more than 1 year ago. Please keep in mind that the information on this page may be outdated, insecure, or just plain wrong today.

Just a quick tip/note on changing the DNS server(s) for a network adapter in Windows from the command line.
To do this, you need elevated privileges on a command line (or you can use ‘runas’ from a non-elevated command line and provide administrative credentials).

c:>netsh interface ip set dns "Local Area Connection" static 8.8.8.8

To set it via DHCP you can just issue:

c:>netsh interface ip set dns "Local Area Connection" dhcp

#netsh