Test a remote TCP port from PowerShell
Build a paste-ready command, then review its compatibility and effects before running it.
Test-NetConnection -ComputerName <host> -Port <port>Complete required fields to copy the generated command.
Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
RequirementsTest-NetConnectionTest-NetConnection must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportTest-NetConnection Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsComputerName : example.comRepresentative successful output; values vary with the selected target and system state.
Known errorsTest-NetConnection: command not foundTest-NetConnection is missing or is not available on PATH.
VerifyTest-NetConnection -ComputerName {{host}} -Port {{port}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01Test-NetConnectionCommandRuns the Test-NetConnection stage of this one-liner.
02-ComputerNameOptionConfigures Test-NetConnection with the -ComputerName option.
03<host>ParameterA value supplied in the Fill parameters section.
04-PortOptionConfigures Test-NetConnection with the -Port option.
05<port>ParameterA value supplied in the Fill parameters section.
Example input
Test-NetConnection -ComputerName example.com -Port 443
Example output
ComputerName : example.com
RemoteAddress : 93.184.216.34
RemotePort : 443
InterfaceAlias : Ethernet
SourceAddress : 192.168.1.42
TcpTestSucceeded : True
Illustrative output — exact values vary by system and data.
Runbooks
Official sources