TL;DR
No nc on Windows: Test-NetConnection -ComputerName host -Port port. Check TcpTestSucceeded.
On Linux the reflex for “is 1433 open?” is:
| |
Windows does not ship nc. The closest PowerShell equivalent is a TCP connect test:
| |
Short alias:
| |
What to look at
TcpTestSucceeded:
| Value | Meaning |
|---|---|
True | Port is open and answering (same as nc connecting) |
False | No connection (firewall, dead service, unreachable IP) |
More detail, closer to nc -v:
| |
Port only, no ping
Test-NetConnection also pings by default. TCP only:
| |
Very old PowerShell
If Test-NetConnection is missing, use the .NET TCP client:
| |