Command Reference

Test-NetConnection

PowerShell Networking Intermediate Risk: Low
Back to Command Library

Summary

Tests name resolution, reachability, routing, or a specific TCP service port.

Syntax

Test-NetConnection <ComputerName> [-Port <Int32>] [-InformationLevel Detailed]

Examples

Test-NetConnection www.microsoft.com -Port 443

Tests DNS resolution and TCP connectivity to HTTPS on the named host.

Permissions

Administrator required: No

Standard reachability and TCP tests usually do not require elevation.

Risk and Impact

Risk level: Low

Changes the system: No

Use only approved destinations; a failed test can reflect a firewall policy rather than an outage.

Supported Platforms

Windows 10 Windows 11 Windows Server

Important Output Fields

RemoteAddress

Address selected after name resolution.

TcpTestSucceeded

Whether a TCP connection reached the requested port.

SourceAddress

Local address used for the test.

Common Errors

TCP connect failed

The port is blocked, closed, filtered, or unreachable.

Official References

Test-NetConnection

Microsoft Learn · Official Documentation

Open Source