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 


August 2006

Netsh Tricks

Cool things you can do with this all-purpose networking tool
RSS
Subscribe to Windows IT Pro | See More Active Directory (AD) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

During the development of Windows NT 5.0— which later became Windows 2000—Microsoft worked briefly with Cisco Systems to try to incorporate some of that company's ideas into the new OS and to help Cisco incorporate some NT 5.0 ideology into Cisco's products. (You can see evidence of the effort today in the Cisco Voice over IP solution, which requires an Active Directory—AD—implementation.) That fleeting flirtation ultimately cooled, but it left behind a framework for Netsh, an extremely useful commandline networking tool.

Even if you have a command-line phobia, you won't be able to resist Netsh, which lets you use the command line or a batch file to perform such tasks as configuring your IP stack settings, setting up a DHCP server from scratch, controlling Windows Firewall, and creating complex and powerful IPsec rules. And Netsh is the only tool I know of that lets you fix a common but frightening side effect of running some anti-spyware applications: completely disabling your IP stack.

Regular readers already know how to use Netsh to configure an IP stack. In "Quick, Automated AD Setup," December 2003, InstantDoc ID 40719, I showed you how to use Netsh to set up an IP address, default gateway, subnet mask, DNS server, and WINS server—all from the command line. Now, I want to show you a few excellent Netsh tricks.

Cool Tool
Have you ever moved your laptop from one place to another (e.g., from work to home, from one WAP to another WAP, from wireless to wired Ethernet), and found that the laptop won't change its IP address? For some reason, the computer has formed an emotional attachment to the old IP address, and because the old address isn't worth squat in the new location, you can't even accomplish a successful ping. In such a case, the Netsh command

netsh int ip reset C:\iplog.txt

is extremely helpful. I refer to this command as the IP phoenix command because it tears down the IP stack and quickly rebuilds it. C:\iplog.txt is the name of a text file that Netsh will use to report its actions. (For some reason, the logging isn't optional: You must specify the name of a file so that Netsh can write out a log.)

You think that's cool? One of the first things I do when I sit down to troubleshoot someone's system is run a Netsh command that no one seems to know about. Typing

netsh diag gui

brings up an HTML page that gives you a hyperlink with which to scan your system. When you click the link, you get a report—arranged in a nice, hierarchical layout—that details every adapter on your system. The command then pings each adapter, along with its associated DHCP servers, its WINS servers, its default gateways, your Microsoft Outlook Express settings, your system's server roles, and so on. Finally, it summarizes the results on a nice, attractive Web page.

Stack Back
Netsh accomplishes much more than I can mention on one page. But I hear you saying, Hey, what was that you said about spyware? Spyware often works by insinuating itself into your Winsock Catalog—essentially, the interface between your applications and the Internet. Spyware likes to settle in there so that it can, well, spy on you. Some anti-spyware tools can find and remove such spyware, but in the process they can end up completely disabling your Windows TCP/IP stack. That's an effective way to protect you from spyware, but it can be the equivalent of destroying the village to save the village.

Fortunately, Netsh can help. Simply type

netsh winsock reset

and press Enter. Now, just restart your system. You might need to follow that up with the Netsh IP Reset command, but in a flash you'll have your IP stack back.

End of Article



Reader Comments
Very helpful.

erutnecca July 28, 2006 (Article Rating: )


Correction: Cisco Voice over IP does not require an Active Directory implementation per se, although certain optional software components such as Cisco Unity (a voicemail solution) do integrate with AD.

granjad August 24, 2006 (Article Rating: )


And to point you further on your quest for Netsh, here's another article:

http://windowsitpro.com/article/articleid/97149/use-netsh-to-easily-change-ip-addresses.html

or type in 97149 into the InstantDoc ID box at the top of the page.

Happy Hunting!

Caroline from editorial November 13, 2008 (Article Rating: )


You must log on before posting a comment.

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




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...


Related Articles Use Netsh to Easily Change IP Addresses

Active Directory (AD) Whitepapers Sustainable Compliance: How to reconnect compliance, security and business goals

Managing Unix/Linux with Microsoft System Center Operations Manager 2007 Cross Platform Extensions Beta

Addressing the Insider Threat with NetIQ Security and Administration Solutions

Related Events Concrete Ways to Make Sure Your SharePoint Deployment Doesn't Blow Up

Implementing VoIP for Your Enterprise

PCI Requirements for Windows and Active Directory: Straight from a Certified Auditor

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Windows 2003: Active Directory Administration Essentials

Related Active Directory (AD) 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