Friday, January 9, 2015

(PowerShell) Filtering netstat output

Update:
This works great :)

netstat -bno


Since standard Windows command line tools can easily interact with PowerShell cmdlets I thought I would try some grep style string filtering.

Lets find all of the ports that are listening on our system:

netstat -nao | Select-String LISTENING

Output:



Or search for a specific port:

netstat -nao | Select-String :139

Output:




Search for all of the UDP ports:

netstat -nao | Select-String UDP

Output:














Now look for all ports that are UDP and on port 1900:

netstat -nao | Select-String UDP | Select-String :1900








:)

No comments:

Post a Comment