Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


May 2004

IP Configuration Selection

RSS
Subscribe to Windows IT Pro | See More Resource Kit Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Every morning, I take my Acer notebook to work; in the evening, I take the notebook to class; at night, I take the notebook home. And every time I change locations, I need to reconfigure my IP settings. I don't like dynamic IP addressing; I want to know the IP address, gateway, and DNS server that I'm using whenever possible.

Certain tools (e.g., Softmate's IPSwitcher) let you select an IP configuration from several sets of configurations. However, the Netsh command achieves the same result. You can use Netsh to change your IP address, subnet mask, gateway, and DNS settings.

To configure IP settings, go to a command prompt and enter

netsh interface ip set 
  address name="local area 
  connection" source=static 
  10.2.2.2 255.0.0.0 
  10.200.0.3 1
netsh interface ip set dns 
  "Local area connection" 
  static 10.2.2.2

The first Netsh command configures the local area connection settings. This command sets the IP address to 10.2.2.2, subnet mask to 255.0.0.0, gateway to 10.200.0.3, and gateway metric to 1. The second Netsh command sets the Preferred DNS Server setting to 10.2.2.2.

I used the Microsoft Windows 2000 Server Resource Kit's Choice command to create a batch file to retrieve user input and the Netsh command to modify the IP settings according to that input. Listing 1 shows my batch file. The menu.txt file, which Listing 2 shows, contains my selection menu.

End of Article



Reader Comments
This is a very great tip ! Just what I needed !

However, how can I run netsh on NT 4.0 workstations ?

Many thanks

Alex May 01, 2004


It is very useful tip. Thank for your offering!

jlee May 09, 2004


Can this run in Windows XP Pro?

Wayne May 21, 2004


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft Kills OneCare, Will Launch Free Security Solution

Microsoft on Tuesday announced that it would retire its $50-a-year security subscription product, Windows Live OneCare, and replace it with a free solution codenamed "Morro." Unlike OneCare, however, Morro will focus only on core anti-malware features and ...

The website is down because someone removed the X-Box

What happens when a manager mistakes a server for a games console. ...

Xbox 360 Overhaul Arrives with New UI, Avatars

Xbox 360 owners who logon to the system's Xbox Live system this morning will receive the most significant functional change yet to the console's user interface, or dashboard. Dubbed the New Xbox Experience, this new front-end features a completely new ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing