Troubleshoot server ports in Windows with Portqry.exe
Published: 02 Jul 2003 15:34 BST
Many IT pros are quite proficient with Telnet and use it adroitly in testing and troubleshooting ports and connectivity. However, Telnet has its limitations for port testing. For instance, it can't determine whether the port is being filtered, and it's unable to test UPD traffic like LDAP or RPC. That's where Portqry.exe comes into the picture. Microsoft has developed this utility to aid in troubleshooting connectivity issues by allowing for better scanning of ports. Here's how to unleash the power behind this utility.
A direct approach
Portqry.exe is actually a pretty straightforward tool. Once you learn the syntax and see a few basic usage examples, you will be ready to use it.
When you run the Portqry command, this tool will report the status of the port on a particular host in one of three forms:
- Listening: When you receive this status back, it means that there is a process listening on the port you specified on your target host.
- Not Listening: A node reporting this status type indicates that there is no process listening on that port on the target computer.
- Filtered: Portqry.exe has a leg up on other similar utilities with its ability to report whether a target computer is filtering out a specific port. Most utilities simply report Not Listening if filtering is occurring, but not Portqry.exe. It will query a port up to three times to determine the correct status.
How to use the utility
As with any command line utility, syntax is paramount. Here are the various switches you can pass this utility from the command line:
- -n [server]--IP address or name of server to query
- -p [protocol]--TCP or UDP or BOTH (default is TCP)
- -e [endpoint]--single port to query (valid range: 1-65535)
- -r [endpoint range]--range of ports to query (start:end)
- -o [endpoint order]--range of ports to query in an order (x,y,z)
- -l [logfile]--name of log file to create
- -s--"slow link delay" waits longer for UDP replies from remote systems
- -I--bypasses default IP address-to-name lookup; ignored unless an IP address is specified after -n
- -q--"quiet" operation runs with no output
Next, we'll look at some examples of how you might put the above variables together in a command that can execute various options.













