It is structured now.ĭepending on your PowerShell version you can also use Convert-FromString which takes single line strings and converts them to objects as well. Which you can then treat like you would any PowerShell object and filter as you see fit or output to CSV or whatever you need to do. Proto Local Address Foreign Address State Process Name The last select statement guarantees the property order, which would be shuffled otherwise, and is the functional equivalent to One liner being used: $nets = netstat -bano|select-string 'LISTENING|UDP' foreach ($n in $nets) | Select 'Proto', 'Local Address', 'Foreign Address', 'State', 'Process Name' Goal: Show all TCP (Listening) and UDP ports and the process associated with each on same line. The output is what I'm looking for with one exception: One of the ports disappears and 'System System5' show up in its place and I can't figure out why it's happening. First I just want to make sure user Erik Bitemo gets credit for the original code I'm using here. I am attempting to use netstat -bano and collect the output in PowerShell for some very specific reporting requirements.