Skip to content

Instantly share code, notes, and snippets.

@lzehrung
Created May 6, 2022 20:58
Show Gist options
  • Save lzehrung/684d3f3fdc64670bb09db7b71fa8c8fb to your computer and use it in GitHub Desktop.
Save lzehrung/684d3f3fdc64670bb09db7b71fa8c8fb to your computer and use it in GitHub Desktop.
open connections
netstat -p TCP -fan | Select -Skip 4 | ForEach {
$Properties = $_.Trim() -split '[\s]+'
[PSCustomObject]@{
'Proto'= $Properties[0]
'Local Address'= $Properties[1]
'Foreign Address'= $Properties[2]
'State'= $Properties[3]
}
} | Select -Expand 'Foreign Address'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment