List listening TCP ports and owning processes with Get-NetTCPConnection
The PowerShell-native replacement for netstat: filter connections by state, port, or process and pipe results instead of parsing text.
01Command
$ Get-NetTCPConnection -State Listen | Select-Object LocalAddress, LocalPort, OwningProcess02What it does
Unlike netstat -ano, Get-NetTCPConnection returns real objects you can filter and export: `-LocalPort 443`, `-RemoteAddress 10.0.0.5`, or `-State Established` all work as parameters. Each object carries OwningProcess, which you resolve to a name with `(Get-Process -Id $_.OwningProcess).ProcessName`. This is the cleanest way to answer 'what's squatting on port 8080' or to audit unexpected listeners on a server.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-NetTCPConnection - PowerShellEvidence: SS64 shows Get-NetTCPConnection usage with -State Listen and -LocalPort filters for listing bound ports.
- Get-NetTCPConnection | Microsoft LearnEvidence: Microsoft documents Get-NetTCPConnection parameters including -State with the Listen value and the OwningProcess property returned for each connection.
Last verified: 2026-09-17 · Category: Network
06Related solutions
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.
The modern, scriptable replacement for nslookup: ask for exact record types, hit specific DNS servers, and see TTLs as objects.
Purge cached DNS lookups so Windows re-resolves hostnames from scratch — the fix for 'the new server is live but my browser still hits the old one'.