Please let us know how useful you find this tip by rating it below!
Do you know what Netsh.exe is capable of doing for you?
One task you can use it for is viewing your TCP/IP settings.
Type the following command in a Command Prompt window (CMD.EXE):
netsh interface ip show config
You can configure your computer's IP address and other TCP/IP related settings. For example, the
following command configures the interface named Local Area Connection with the static IP address
192.168.0.100, the subnet mask of 255.255.255.0 and a default gateway of 192.168.0.1:
netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0
192.168.0.1 1
(The above line is one long line, so watch for word wrap. Copy and paste it as one line.)
Netsh.exe can also be useful in certain situations when you have a portable computer that needs to be relocated between two or more office locations, while still maintaining a specific and static IP address configuration. With Netsh.exe, you can save and restore the appropriate network configuration all from the command prompt.
Connect your portable computer to location #1, and then manually configure the required network settings.
Now, you need to export your current IP settings to a text file. Use the following command:
Requires Free Membership to View
netsh -c interface dump > c:\location1.txt
When you reach location #2, do the same thing, only keep the new settings to a different
file:
netsh -c interface dump > c:\location2.txt
You can go on with as many other locations you may need.
Now, whenever you need to travel between locations, you can enter the following command in a
Command Prompt window (CMD.EXE):
netsh -f c:\location1.txt or netsh -f c:\location2.txt.
Netsh.exe can also be used to configure your NIC to automatically obtain an IP address from a
DHCP server:
netsh interface ip set address "Local Area Connection" dhcp
You can use this command to setup WINS:
netsh interface ip set wins "Local Area Connection" static 192.168.0.200
Or, if you want, you can configure your NIC to dynamically obtain its DNS settings:
netsh interface ip set dns "Local Area Connection" dhcp
As you can see, Netsh.exe is very customizable and useful.
ABOUT THE AUTHOR: Ron is the PC systems administrator at military and government contractor
MPD Inc., of Owensboro, KY. He is the administrator for SMS 2.0, SMS 2003, Exchange 2000, Active
Directory, Windows 2000 Server and Windows Server 2003, PC desktops, workstations and
laptops.
This was first published in January 2005
Enterprise Server Strategies for the CIO
Join the conversationComment
Share
Comments
Results
Contribute to the conversation