How to script changes to your TCP/IP setting in WindowsXP

Microsoft created a cool scriptable utility called netsh. that allows you to make changes to your TCP/IP settings very simply. To try it out, open a command prompt and enter the following:

netsh

You should see the prompt change to netsh>. Next, enter this command:

help

You should now see the list of all the commands you can use. Now enter:

interface

You should now see the prompt change to netsh interface>. That means you are now executing commands in this context. In each context you can type help to see what commands are available. Next type:

show interface

You should now see a list of all the network interfaces on your machine. What’s cool is you can put a statement like this into a batch file to automate setting changes:

netsh interface ip set dns name=”Wireless Network Connection” static X.X.X.X primary

Where X.X.X.X is the ip address that you want to set as the primary dns for the network connection named “Wireless Network Connection”. I have found this very helpful when used to automatically configure settings for a VPN connection.