Thursday, September 15, 2005

Use netsh to configure your network settings when using your laptop in multiple locations

My laptop is a constant companion, traveling with me between two Compuware offices and home. As you may suspect, I occasionally have to tweak my network settings in order to get things to work properly.

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 to work at your current location
  2. From a command prompt, run: netsh -c interface ip dump > c:\.txt The filename and path can be anything, it is just a text file: make sure to name the file to reflect the location you're currently configuring (like home.txt).
  3. You now can manually edit this text file, ‘#’ 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's faster this way).
  4. Do this for every location you use your laptop.

Now, whenever you need to load the settings you saved for a given location, just open a command prompt and run: netsh -f c:\home.txt

No comments: