Test-NetConnection
Test a TCP port or route
Test-NetConnection -ComputerName example.com -Port 443
- Works on
- Windows
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Test-NetConnection
Windows-only and slower than Test-Connection. Worth it when you care about a port. TcpTestSucceeded is the property that matters.
Try this
Test-NetConnection -ComputerName example.com -Port 443 | Select-Object ComputerName, RemotePort, TcpTestSucceeded
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | nc -zv example.com 443 |
More in From bash and From cmd.