Tip

Netsh.exe offers a unique 'view'

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

    Requires Free Membership to View

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:
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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.