During my recent two days of torment caused by a flaky Java application, I had to change the preferred and alternate DNS server entries for one of my network cards. Ordinarily that would be simple, but with an unresponsive Explorer interface refusing to open any network connection dialogs I needed to do it from the command line.
Enter the network shell (netsh) – a fantastic command line utility that has sneaked into recent versions of Windows and seems to have more and more functionality added with each new release.
After entering the
interface ip got me to the TCP/IP interface settings; then
show dns gave me the details of the current DNS servers;
set dns "Local Area Connection" ipaddress allowed me to set the preferred DNS server and
add dns "Local Area Connection" ipaddress index=2 set the alternate DNS server (that was the difficult one to work out – I had tried to set dns with a list of IP addresses but that does not work!); finally,
exit the network shell and type
ipconfig -all to check settings the normal way.
I love the command prompt!