Monday, June 27, 2016

HOW TO - GREP / FIND PowerShell Output

q: In Windows CLI (Command Prompt) we use | find "" all the time after a standard command to filter the results.  How can we use find with PowerShell?
For example:
netstat -ano | find "LISTENING"

a: As we discovered you can do anything in PowerShell, but it is considerably more complex.
To run the same command above inside PowerShell it looks like this:
netstat -ano | Out-String -Stream | Select-String -Pattern "LISTENING"

No comments:

Post a Comment