PowerShell - Display network connections (equivalent to netstat)
2 min read · Updated 10 January 2025
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 connectionsGet-NetTCPConnection
# Display local address, local port and processGet-NetTCPConnection | Select-Object -Property LocalAddress,LocalPort,@{ Label='Process' ;Expression={ (Get-Process -Id $_.OwningProcess).name } }
# Filter by process idGet-NetTCPConnection -OwningProcess 4321
# Filter by local addressGet-NetTCPConnection -LocalAddress 0.0.0.0
# Filter by local portGet-NetTCPConnection -LocalPort 53
# Filter by remote addressGet-NetTCPConnection -RemoteAddress 1.2.3.4
# Filter by local portGet-NetTCPConnection -RemotePort 12345
# Display listening TCP portsGet-NetTCPConnection -State Listen
# Show established connectionsGet-NetTCPConnection -State Established
# Show UDP connectionsGet-NetUDPEndpoint
# Display local address, local port and processGet-NetUDPEndpoint | Select-Object -Property LocalAddress,LocalPort,@{ Label='Process' ;Expression={ (Get-Process -Id $_.OwningProcess).name } }
# Filter by process idGet-NetUDPEndpoint -OwningProcess 4321
# Filter by local addressGet-NetUDPEndpoint -LocalAddress 0.0.0.0
# Filter by local portGet-NetUDPEndpoint -LocalPort 53Related links
- PowerShell
PowerShell - Simply send objects to different variables
PowerShell - Tip - Simply send objects to different variables
1 min read
- PowerShell
Test-Connection and Test-NetConnection
Ping with Test-Connection (ping count, boolean result, remote pings over WinRM) and check SMB, HTTP or RDP ports with Test-NetConnection.
2 min read
- PowerShell
PowerShell - Testing name resolution (equivalent to nslookup)
PowerShell commands to test name resolution (equivalent to nslookup)
2 min read
- PowerShell
PowerShell - View and manage DNS configuration of network interfaces
PowerShell commands to display and manage DNS configuration of network interfaces
4 min read
- PowerShell
PowerShell - Managing IP configuration of network interfaces
PowerShell commands to view and modify the IP configuration of network interfaces
4 min read
- PowerShell
PowerShell - Managing the status and configuration of network interfaces
PowerShell commands to view and modify the status and configuration of network interfaces (disable IPv6, enable/disable an interface)
4 min read
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 treeNew site · Reference
Group Policy settings
ADMX settings for Windows 10, 11, Server and applications: registry keys, PowerShell commands and use cases.
Browse the policies