The command netstat is a handy tool for displaying the active ports and addresses on a Windows or *nix machine. For the Windows environment often the output scrolls past the buffer for the command prompt window, thus loosing important information about lower port numbers.

Adding a few switches and an output tag can dump the information to a standard text file. The text file is movable, searchable, and easy to copy important information from. This should work in any OS, and has been verified on XP, 2003, Vista, 2008 and even the upcoming Windows 7.

Start by opening a cmd window. Start -> Run -> cmd for XP and Server 2003. Start -> Search -> cmd -> right-click and ‘run as Administrator’ for Vista, Server 2008, and Windows 7. This opens a standard dos window suitable for the command.

In the dos window move to a writable directory. C: could work, or maybe cd C:UsersNAMEDesktop would be better for Vista, Server 2008, and Win7.

Now comes the magic. Type the code at the prompt:
netstat -abn > out.txt
This outputs the netstat output with numeric format, all ports (including listening), and the associated program that is using that port. It writes all this information to a file called out.txt in the current directory rather than to the command window.

Simply open the file out.txt with word, notepad, or other editor. The format of the information displayed is:
Protocol LocalIP:port RemoteIP:port state
[program or service]

Learn more about this topic at >

Leave a Comment

Previous post:

Next post: