PortQry parameters for command-line mode

-n <name>Query the specific destinationThis is the only required parameter for command-line mode.The <name> value represents the name or IP address of the computer to query. This value cannot include spaces.
-p <protocol>Use the specified protocolThe <protocol> value represents the type of port to query (possible values are tcpudp, or both).The default value is tcp.
-e <port_number>Specify the target port (also known as “endpoint”)The <port_number> value represents the port to query on the destination computer.The default value is 80.
-o <port_number>,<port_number>Specify multiple target ports in a sequenceThe <port_number>,<port_number> values represent comma-delimited list of port numbers to query in a sequence. Do not use spaces around the commas.
-r <port_number>:<port_number>Specify a range of target portsThe <port_number>:<port_number> values represent the starting and ending port numbers, separated by a colon. Do not use spaces around the colon.The starting port number must be smaller than the ending port number.
-l <filename.txt>Generate a log fileThe <filename.txt> value represents the name and extension of the log file. This value cannot include spaces.When the command runs, PortQry creates the log file in the directory where it’s installed.If the file already exists, PortQry asks you to confirm that you want to overwrite it (unless you also use the -y parameter).
-yOverwrite previous log fileWhen you use -y together with -l, PortQry overwrites the existing log file without prompting you to confirm the action.If the PortQry command string does not include -l, PortQry ignores -y.
-slWait extra time for response (also known as slow link delay)Use this parameter to double the time that PortQry waits for a response from a UDP port before PortQry determines that the port is NOT LISTENING or that it’s FILTERED. When you query over slow or unreliable network links, the normal wait time may be too short to receive a response.
-nrSkip reverse name lookupBy default, when you use -n to specify an IP address for the target computer, PortQry does a reverse name lookup to resolve the IP address to a name. This process may be time-consuming, especially if PortQry can’t resolve the IP address. Use -nr to skip this step of the query.If you use -n to specify a computer or domain name, PortQry ignores -nr.
-sp <port_number>Query from a specific source portThe <port_number> value represents the port that PortQry uses to send the query.PortQry can’t use a port that another process is already using. If the port that you specify is already in use, PortQry returns the following error message:Cannot use specified source port.
Port is already in use.
Specify a port that is not in use and run the command again.In the following cases, PortQry uses the specified port for the first test of the query, but not the second test:RPC (TCP and UDP ports 135)LDAP (UDP port 389)NetBIOS Adapter status query (UDP port 137)In these cases, PortQry uses an ephemeral port for the second test. When this occurs, PortQry records “Using ephemeral source port” in its output.If the computer where PortQry is installed also runs the IPSec policy agent, UDP port 500 may not be available to use as a source port. To temporarily turn off the IPSec policy agent so that you can use port 500, run net stop PolicyAgent. When you have finished testing, run net start PolicyAgent.
-cn !<community_name>!Query an SMTP communityThe <community_name> value represents the name of the SNMP community to query. You must delimit this value by using exclamation points, as shown in the left column.If the SNMP service is not listening on the target port, PortQry ignores -cn.The default community name is public.
-qRun PortQry in quiet modeWhen you use -q, PortQry suppresses all screen output except for error messages.To see output other than error messages, use -q together with -l. PortQry records the normal output in the log file.If a log file already exists and you use -q together with -l, PortQry overwrites the existing log file without prompting you.You cannot use -q together with -o-r, or -p both.This parameter is especially helpful when you use a batch file to run a PortQry command string.

ตัวอย่าง SQL Server

> PortQry.exe -n 192.168.1.x -p tcp -e 1433