Switching between static and dynamic Dns

I was fed up typing in the IP address of test machines that are on a different domain and dns within my network so decided to work out how to quickly switch to using that DNS when at work and back to dynamic when not.

It turns out to be really simple. The DNS being used is adapter specific which makes sense when you think of VPN and multiple other uses so you will need to know the name of the adpater you are using.

In my case it is “Wireless Network Connection”

netsh interface ip set dns "Wireless Network Connection" static ;

to set it back:

netsh interface ip set dns "Wireless Network Connection" dhcp

netsh should be in your path so this can be run from any directory in the command line.