Skip navigation

Q. What's the Portqry tool?

A. Portqry is a Microsoft tool that provides information about TCP and UDP ports that are "listening" locally and which process or service is offering IP services on a system. For example, if a server is listening on port 80, this means it's offering a Web (HTTP) service. You can download Portqry at Microsoft download site. After you download the file, execute it to extract the files that you need to execute the command. The simplest example of how to use Portqry is to specify the -local switch on the command, like this:

portqry -local

Executing this command displays on screen a list of all ports in use on the local system and which process offers the IP service, similar to this sample output:

======================================================

Process ID: 512 (msmsgs.exe)

Process doesn't appear to be a service

PID Port Local IP State Remote IP:Port
512 TCP 1235 192.168.1.101 ESTABLISHED 207.46.106.195:1863
512 UDP 1036 127.0.0.1 *:*

This example shows the Microsoft Messenger (msmsgs.exe) ports that are in use.

You can also use Portqry to check the status of open ports on remote systems. For example, to check the status of the Web port on a system, specify the -n switch and the system's IP address, like this:

portqry -n 192.168.1.1

You'll see messages similar to these:

Querying target system called:

192.168.1.1

Attempting to resolve IP address to a name...

Failed to resolve IP address to name

querying...

TCP port 80 (http service): LISTENING

The last line of the sample output shows that the queried server is offering a Web service. If you want to check the status of a specific port, specify the -e switch and the port to check. The following sample command checks for a listener on port 80 for a remote system that has an IP address of 192.168.1.1.

portqry -n 192.168.1.1 -e 80

To check the status of a range of ports, specify the -r switch and the starting and ending port range. The following sample command checks for all ports between 10 and 100:

portqry -r 10:100

Other utilities are available that work similarly to Portqry and query TCP listeners. However, unlike those tools, Portqry also queries UDP listeners. Portqry actually sends correctly formatted UDP payloads for the most popular UDP-based services, such as Lightweight Directory Access Protocol (LDAP) and DNS. For example, to check for DNS over UDP, you'd run the command

portqry -n &ltserver&gt -p udp -e 53

You can find articles about how to use Portqry for troubleshooting Exchange Server and Active Directory (AD) problems at Microsoft Exchange Server article and Microsoft Active Directory article.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish