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.

WindowsnetworkportspowershellLow risk
Run `Get-NetTCPConnection -State Listen` to list every bound TCP port, and use OwningProcess with Get-Process to identify the owner.

01Command

Command
$ Get-NetTCPConnection -State Listen | Select-Object LocalAddress, LocalPort, OwningProcess

02What 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

RiskLow risk
RequirementsAdd `| Select-Object ... , @{n='Process';e={(Get-Process -Id $_.OwningProcess).ProcessName}}` to resolve process names; listening-process details may need an elevated window.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-NetTCPConnection - PowerShell
    SS64 · technical · 2026-09-17
    Evidence: SS64 shows Get-NetTCPConnection usage with -State Listen and -LocalPort filters for listing bound ports.
  • Get-NetTCPConnection | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: 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