Use PowerShell Test-NetConnection to test common infrastructure ports such as DNS, SMB, WinRM, RDP, HTTPS and SQL Server.
01 Choose the target
06 Validate from the correct source Repeat the test from the system that actually needs the connection because network controls can differ by source subnet.
Define the server and port list based on the application dependency you need to validate.
Choose the target
Test each port
Use Test-NetConnection -ComputerName <server> -Port <port> and capture TcpTestSucceeded.
Use DNS-aware testing
Test the hostname and, when appropriate, the IP address separately to distinguish DNS problems from network or firewall problems.
Export results
Return one object per port with target, port and status so results can be written to CSV.
Interpret failures
A failed TCP test proves the connection could not be established from that source. It does not by itself identify whether the cause is the server, firewall, route or service.
Validate from the correct source
Repeat the test from the system that actually needs the connection because network controls can differ by source subnet.
Explore more TechRunbook guides
Continue with practical infrastructure troubleshooting, PowerShell scripts and operational runbooks.
Browse all articles →