PowerShell - Display network connections (equivalent to netstat)

2 min read · Updated 10 January 2025

Did this guide help you? You can support me by subscribing to the channel, sharing it, disabling your ad blocker or making a donation. Thank you!

Hello,

This article introduces the Get-NetTCPConnection and Get-NetUDPEndpoint PowerShell commands, which display network connection information.
Unlike netstat, which displays network connections for TCP and UDP ports, PowerShell has one command for TCP and another for UDP.

# Display TCP connections
Get-NetTCPConnection
# Display local address, local port and process
Get-NetTCPConnection |
Select-Object -Property LocalAddress,LocalPort,@{ Label='Process' ;Expression={ (Get-Process -Id $_.OwningProcess).name } }
# Filter by process id
Get-NetTCPConnection -OwningProcess 4321
# Filter by local address
Get-NetTCPConnection -LocalAddress 0.0.0.0
# Filter by local port
Get-NetTCPConnection -LocalPort 53
# Filter by remote address
Get-NetTCPConnection -RemoteAddress 1.2.3.4
# Filter by local port
Get-NetTCPConnection -RemotePort 12345
# Display listening TCP ports
Get-NetTCPConnection -State Listen
# Show established connections
Get-NetTCPConnection -State Established
# Show UDP connections
Get-NetUDPEndpoint
# Display local address, local port and process
Get-NetUDPEndpoint |
Select-Object -Property LocalAddress,LocalPort,@{ Label='Process' ;Expression={ (Get-Process -Id $_.OwningProcess).name } }
# Filter by process id
Get-NetUDPEndpoint -OwningProcess 4321
# Filter by local address
Get-NetUDPEndpoint -LocalAddress 0.0.0.0
# Filter by local port
Get-NetUDPEndpoint -LocalPort 53

Related links

Follow me on

Support me

Buy Me a Coffee at ko-fi.com

New site · Reference

The Windows directory tree

Native Windows folders, files and logs: what they are for, what they contain, with commands and Microsoft sources.

Browse the tree

New site · Reference

Group Policy settings

ADMX settings for Windows 10, 11, Server and applications: registry keys, PowerShell commands and use cases.

Browse the policies