Field notesAUWENSearch
Explore Systems
← Command indexPowerShell / network

Test-NetConnection

Test a specific TCP destination and distinguish it from an application test.

Syntax

UPPERCASE words are placeholders to replace. Brackets in the syntax line describe optional arguments; do not type those brackets literally.

Test-NetConnection -ComputerName HOST -Port PORT [-InformationLevel Detailed]

Example

Test-NetConnection -ComputerName 127.0.0.1 -Port 8085 -InformationLevel Detailed

Expected result

TcpTestSucceeded is True if the local teaching service is listening and the TCP connection succeeds; otherwise False with diagnostics. Run the Docker health-check lab first for a known listener.

Notes and traps

Windows NetTCPIP module; availability differs by OS and PowerShell installation. Explicitly supply the target to avoid probing the cmdlet's default external destination. A TCP handshake does not validate HTTP response content, TLS trust, credentials or readiness.

Try it

Compare this TCP test with visiting /ready after the Docker lesson's readiness marker is created. Can TCP succeed while HTTP returns 503?

Answer and reasoning

Yes. The server is still listening, so TCP can connect while the application reports not ready. Keep the three questions separate: is there a listener, can I connect, and does the application perform the intended operation?

Study the related guide →

Related commands

Related tasks may need different flags and have different semantics. Check the entry before translating a command between shells.

Official reference ↗

Updated 14 September 2026. Microsoft reference reviewed 14 September 2026; not executed on Windows.