Powershell - Display network connections (equivalent to netstat)

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make 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