### PortQry interactive mode output Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example output from starting PortQry in interactive mode. Shows the interactive prompt and default settings. ```output Portqry Interactive Mode Type 'help' for a list of commands Default Node: 127.0.0.1 Current option values: end port= 80 protocol= TCP source port= 0 (ephemeral) > ``` -------------------------------- ### Start PortQry interactive mode with -i Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Starts PortQry in interactive mode. The output shows the interactive prompt with default node 127.0.0.1, end port 80, protocol TCP, and source port 0 (ephemeral). ```console portqry -i ``` -------------------------------- ### portqry -local output excerpt Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example output from `portqry -local` showing active TCP/UDP ports, their local IP, state, and remote IP:port. Use this to verify local port usage. ```text TCP/UDP Port Usage 96 active ports found Port Local IPState Remote IP:Port TCP 80 0.0.0.0 LISTENING 0.0.0.0:18510 TCP 80 169.254.149.9 TIME WAIT 169.254.74.55:3716 TCP 80 169.254.149.9 TIME WAIT 169.254.200.222:3885 TCP 135 0.0.0.0 LISTENING 0.0.0.0:10280 UDP 135 0.0.0.0 : UDP 137 169.254.149.9 : UDP 138 169.254.149.9 : TCP 139 169.254.149.9 LISTENING 0.0.0.0:43065 TCP 139 169.254.149.9 ESTABLISHED 169.254.4.253:4310 TCP 139 169.254.149.9 ESTABLISHED 169.254.74.55:3714 ``` -------------------------------- ### PortQry interactive mode DNS query output Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example output after entering 'q dns' at the interactive mode command prompt to send a DNS query. Shows the service name resolution and the listening status of UDP port 53. ```output resolving service name using local services file... UDP port resolved to the 'domain' service IP address resolved to myserver.contoso.com querying... UDP port 53 (domain service): LISTENING > ``` -------------------------------- ### PortQry interactive mode default node output Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example output after entering 'n 10.0.1.10' at the interactive mode command prompt to set the default node to IP address 10.0.1.10. ```output Default Node: 10.0.1.10 > ``` -------------------------------- ### portqry -local restricted access output Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example output from `portqry -local` when the security context lacks sufficient permissions. It shows a warning that restrictions may prevent access and recommends running as local administrator. ```text Port and Module Information by Process Note: restrictions applied to some processes may prevent Portqry from accessing more information For best results run Portqry in the context of the local administrator ====================================================== Process ID: 0 (System Idle Process) PIDPortLocal IPState Remote IP:Port 0TCP 4442 169.254.113.96 TIME WAIT 169.254.5.136:80 0TCP 4456 169.254.113.96 TIME WAIT 169.254.5.44:445 Port Statistics TCP mappings: 2 UDP mappings: 0 TCP ports in a TIME WAIT state: 2 = 100.00% Could not access module information for this process ====================================================== ``` -------------------------------- ### PortQry log file output for PID monitoring Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Example log file output produced by the portqry -wpid command. Shows the command run, local computer name, watching PID, verbose output, service details, port mappings, and loaded modules. ```output PortQry Version 2.0 Log File System Date: Command run: portqry -wpid 1276 -wt 2 -v -l pid.txt Local computer name: host123 Watching PID: 1276 Checking for changes every 2 seconds verbose output requested Service Name: DNS Display Name: DNS Server Service Type: runs in its own process ============ System Date: ====================================================== Process ID: 1276 (dns.exe) Service Name: DNS Display Name: DNS Server Service Type: runs in its own process PIDPortLocal IPState Remote IP:Port 1276TCP 53 0.0.0.0 LISTENING 0.0.0.0:2160 1276TCP 1087 0.0.0.0 LISTENING 0.0.0.0:37074 1276UDP 1086 0.0.0.0 : 1276UDP 2126 0.0.0.0 : 1276UDP 53 127.0.0.1 : 1276UDP 1085 127.0.0.1 : 1276UDP 53 169.254.11.96 : Port Statistics TCP mappings: 2 UDP mappings: 5 TCP ports in a LISTENING state: 2 = 100.00% Loaded modules: C:\WINDOWS\System32\dns.exe (0x01000000) C:\WINDOWS\system32\ntdll.dll (0x77F40000) C:\WINDOWS\system32\kernel32.dll (0x77E40000) C:\WINDOWS\system32\msvcrt.dll (0x77BA0000) C:\WINDOWS\system32\ADVAPI32.dll (0x77DA0000) C:\WINDOWS\system32\RPCRT4.dll (0x77C50000) C:\WINDOWS\System32\WS2_32.dll (0x71C00000) C:\WINDOWS\System32\WS2HELP.dll (0x71BF0000) C:\WINDOWS\system32\USER32.dll (0x77D00000) C:\WINDOWS\system32\GDI32.dll (0x77C00000) C:\WINDOWS\System32\NETAPI32.dll (0x71C40000) ``` -------------------------------- ### Run PortQry in local mode Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Use this syntax to run PortQry in local mode on the computer where PortQry runs. The -local, -wport, and -wpid parameters are mutually exclusive; -wt cannot be used alone or with -local, and -q does not function in local mode. ```console portqry -local | -wpid | -wport [-wt ] [-l ] [-v] ``` -------------------------------- ### PortQry command-line syntax Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Basic syntax for running PortQry in command-line mode. The -n parameter is required and specifies the IP address, computer name, or domain to query. Optional parameters can be added to the command string. ```console portqry.exe -n [options] ``` -------------------------------- ### Batch file for quiet mode with log output Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Batch file that runs PortQry in quiet mode with -q, logging to pqlog.txt. The output shows the resulting log file content, including the command run and the LISTENING status for TCP port 443. ```console :Top portqry -n 169.254.18.22 -e 443 -nr -l pqlog.txt -q :end ``` ```output PortQry Version 2.0 Log File System Date: Thu Sep 16 10:35:03 2021 Command run: portqry -n 169.254.18.22 -e 443 -nr -l pqlog.txt -q Local computer name: SOURCESERVER Querying target system called: 169.254.18.22 TCP port 443 (https service): LISTENING ========= end of log file ========= ``` -------------------------------- ### PortQry interactive query shortcut syntax Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Syntax for using query shortcuts in interactive mode. Replace with one of the shortcuts from the table (e.g., dns, ftp, imap). If omitted, queries TCP port 80. ```console q ``` -------------------------------- ### Set PortQry interactive mode option Source: https://learn.microsoft.com/troubleshoot/windows-server/networking/portqry-command-line-port-scanner-v2 Use this syntax to set options in PortQry interactive mode, such as source port or slow link delay. Replace