Using Select-String to Focus on the important stuff

by Jul 9, 2009

Select-String is a fun cmdlet. Whenever a command returns string data, Select-String filters out text that does not contain a specific keyword. For example, with Select-String you can strip the output from native commands like ipconfig or route print like this:

ipconfig | select-string IP
route print | select-string 127.0.0.1

Note that select-string compares text case-insensitive unless you specify the -CaseSensitive switch parameter:

whoami /priv | Select-String Disable -caseSensitive