Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [hashtable]$processes = @{}
- Get-Process | ForEach-Object { $processes.Add( $_.Id , $_ )} ## build dictionary/hashtable keyed on the PID for fast lookup
- Get-NetTCPConnection | Where-Object { ( $_.LocalAddress -eq "0.0.0.0" -or $_.LocalAddress -eq "127.0.0.1" ) -and $_.State -ne "Bound" } |sort-object -property LocalPort|select-object -property LocalAddress,LocalPort,RemoteAddress,RemotePort,State,OwningProcess,@{n='Process';e={$processes[ [int]$_.OwningProcess ]|select-object -expandproperty name}}|format-table -auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement