Wednesday, February 02, 2005

Using netsh to set your network up automatically when using your laptop in multiple locations

My laptop is a constant companion, traveling with me between my offices in New Hampshire, Cambridge and home. As you may suspect, I constantly have to tweak my network connections in order to get things to work.

I recently stumbled across an administrator utility named netsh.exe which has made this task a lot easier. It is very powerful and really well documented in Windows XP's help center. The following is a set of steps you can use to create netsh scripts which will set up your laptop for any location you're trying to connect from.

  1. Set up your network the way you like it at your current location
  2. Run ‘netsh -c interface ip dump > c:\location1.txt
    1. The filename and path can be anything, it is just a text file.
    2. You could run the command: ‘netsh –c interface dump > c:\location.txt’; however, this dumps a lot of stuff that you don’t care about, AND it resets each connection before setting it to a new value which takes FOREVER.
    3. You can manually edit the file when it is done, ‘#’ is a comment character so you can comment out large blocks for testing reasons. I usually comment out everything but the adapters I know I’ll need at a given location. It is much faster this way.
  3. Do this for every location you use your laptop.
  4. When you need to load the settings you saved for a given location, just run: ‘netsh -f c:\location1.txt’ It takes a couple of minutes, but it works every time.

Thanks to Cappy for these instructions.

No comments: