Hack 45 Use netsh to Change Configuration Settings

 < Day Day Up > 

figs/beginner.gif figs/hack45.gif

You can use the Windows 2000 Netshell (netsh) command to do some amazing things, including switching your machine between two different network configurations .

If you move your machines around a lot, you know the pain of having to reconfigure their network settings so they can continue to talk on the network. This sort of thing is common in a testbed environment where you are building and testing different network-deployment scenarios prior to rolling out the real thing. You might also have to reconfigure network settings for your computers if you have a routed network with several subnets in one building and frequently move machines from one subnet to anothera common scenario in a physics lab or similar academic environment. Otherwise, if you have a laptop that you need to use at work, at home, and at the sites of several clients , being able to save and reload network configurations would be a real timesaver.

There are a few utilities on the market that allow you to quickly switch between different network configurations. NetSwitcher (http://www.netswitcher.com) is one effective tool. But did you know you can do the same thing using the Windows 2000 Netshell ( netsh ) command?

Using netsh

Here's how it works. First, you dump your network settings to a text file through the command line, as follows :

 netsh -c interface dump > NetworkSettings.txt 

This command stores your current network settings in a text file named NetworkSettings.txt . Now, let's say you have to reconfigure your machine's network settings to repurpose the machine or move it to a different part of the network. Then, later, if you need to restore your machine's original network settings, you can simply type the following command and load back in the previously dumped settings:

 netsh -f NetworkSettings.txt 

Note that the destination filename is not important, so you can effectively create multiple configuration files. You can create and name one for each network configuration you need. For example, you can use Work.txt for the office, Home.txt for your home configuration, and something like Client.txt to hold the values for a network you are temporarily visiting.

Rod Trent

 < Day Day Up > 


Windows Server Hacks
Windows Server Hacks
ISBN: 0596006470
EAN: 2147483647
Year: 2004
Pages: 163
Authors: Mitch Tulloch

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net