How to monitor resources that should not be normally accessible on certain TCP/UDP ports?
Q: I need to check whether Windows Firewall blocks certain TCP/UDP ports. How can I monitor the port that should normally be closed for connections?
A: If simple TCP/UDP connectivity check does, you can use a “Script or Program” monitor to watch such resources
Please follow the below steps to set up such monitors.
1. Download portqry installer from Microsoft site:
https://www.microsoft.com/en-us/download/details.aspx?id=17148
The above utility works for Windows 2000 and later versions.
Run the downloaded PortQryV2.exe; the program asks where to install the utility. Instructions below assume you chose
C:\scripts
as directory to install portqry into. If you choose another folder name, please make appropriate changes to the instructions below.
2. Download VBScript (wrapper for portqry utility) archive:
reverse-port-query.zip (978 bytes, SHA1 checksum 0d40a02e56e7ff863ed2cf74bd5e5fd4295cd7dd)
Unpack reverse-port-query.txt file from it, rename it to reverse-port-query.vbs and move to C:\scripts (or whatever folder do you choose).
Note: if on step 1 you chose folder different from C:\scripts to place portqry into, please open reverse-port-query.vbs in any text editor such as Notepad and change line 12:
portQry = "C:\scripts\portqry.exe"
(change if necessary to specify full path to portqry utility).
3. Start IPNetwork Monitor GUI client and create “Script or Program” monitor (for the host where IPNetwork is running). Set the monitor Main parameters like below:
Arguments line should contain three parameters, space-separated:
- device/host DNS name/IP address
- protocol (UDP or TCP, case-insensitive)
- port number (integer value)

The above sample monitor will be in OK state, while example.com host doesn’t allow connections to TCP port 25 (that matches SMTP server).
Note: please make sure you state connection timeout value in “State conditions” tab to 10 or more seconds (typical Windows timeout limit while establishing TCP/UDP connections).
Related topics
Check out our Knowledge Base where we answer questions regarding various topics. Use a Script or Program monitor with the reverse-port-query.vbs wrapper around Microsoft PortQry. The monitor can stay OK while the target port refuses connections. Pass the target device or host name, the protocol value TCP or UDP, and the port number as three space-separated arguments. Set the connection timeout in the State conditions tab to 10 seconds or more, matching typical Windows timeout behavior for TCP and UDP connection attempts.
Frequently Asked Questions
How can a normally closed TCP or UDP port be monitored?
What arguments does the reverse port query script need?
What timeout should be used for reverse TCP or UDP checks?