Remotely change IP settings on Windows XP/Vista/7 using netsh

Remote IP Change

netsh command line

Many network administrators need to change a few settings from time to time, especially when you update your network equipment. The more user you have, more time it takes. However, there is this little command line tool which help you to remotely change IP settings on any Windows remote computer : netsh.

There are 2 choices : You can either spawn a command line process on the remote computer and then play with netsh, or you can do netsh remotely from your computer.

 

Spawn a process using psexec.exe

First of all, what is psexec.exe ? PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software.

Download link : http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx

Command line to spawn a cmd.exe process on remote computer :

psexec.exe \\computername -u computername\administrator cmd.exe

It should then ask you for administrator password, and then spawn process.  From there you can start playing with netsh as like you are on the remote computer, here a main command lines for netsh control :

  • Display IP configuration : netsh interface ip show config
  • Change default gateway on Windows XP : netsh interface ip set address “Local Area Connection” gateway=192.168.0.1 gw=0
  • Change ip, netmask and default gateway on Windows Vista/7/8 : netsh interface ip set address “Local Area Connection” static 192.168.0.10 255.255.255.0 192.168.0.1
  • Change main DNS server : netsh interface ip set dns “Local Area Connection” static 192.168.0.1
  • Add a second DNS server : netsh interface ip add dns “Local Area Connection” static 192.168.0.2

 Note : Remember to input correct “Local Area Connection” on previous commands.

Play with netsh -r

You can remotely change IP config on an domain administrator account using the following switch of netsh command : -r

For example : netsh -r REMOTE_MACHINE_NAME interface ip show config

 

 

Spread the love...Share on FacebookShare on Google+Pin on PinterestShare on RedditTweet about this on TwitterEmail this to someone