Skip to content

Instantly share code, notes, and snippets.

@koraysaritas
Created October 21, 2019 05:55
Show Gist options
  • Save koraysaritas/a48ff149fa00c1bc4ddcaf96d5e9a500 to your computer and use it in GitHub Desktop.
Save koraysaritas/a48ff149fa00c1bc4ddcaf96d5e9a500 to your computer and use it in GitHub Desktop.
List number of open ports
Get-NetTCPConnection | Group-Object -Property State, OwningProcess | Select -Property Count, Name, @{Name="ProcessName";Expression={(Get-Process -PID ($_.Name.Split(',')[-1].Trim(' '))).Name}}, Group | Sort Count -Descending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment