Last active
September 28, 2023 10:19
-
-
Save winkler-winsen/382b2198c1487096102eeb2411137bee to your computer and use it in GitHub Desktop.
PowerShell netstat -anob replacement. Shows listening TCP and UDP ports and its process names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Get-NetUDPEndpoint | | |
Select-Object @{L="Proto"; E={"UDP"}}, | |
LocalAddress, | |
LocalPort, | |
OwningProcess, | |
@{L="Process"; E={((Get-Process -ID $_.OwningProcess).Name)}}, | |
@{L="Path"; E={((Get-Process -ID $_.OwningProcess).Path)}}) + | |
(Get-NetTCPConnection -State Listen | | |
Select-Object @{L="Proto"; E={"TCP"}}, | |
LocalAddress, | |
LocalPort, | |
OwningProcess, | |
@{L="Process"; E={((Get-Process -ID $_.OwningProcess).Name)}}, | |
@{L="Path"; E={((Get-Process -ID $_.OwningProcess).Path)}}) | | |
Sort-Object Process, Proto, LocalPort, LocalAddress | | |
Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment