Powershell Select String

See without the CaseSensitive parameter, Select-String would recognize both of the strings as matches.

Example


        PS C:\> "Hello","HELLO" | select-string -pattern "HELLO" 
    

Copy and Try it

Example


        PS C:\> "Hello","HELLO" | select-string -pattern "HELLO"  -casesensitive
     

Copy and Try it

Using select string we can get event log

Example


$events = get-eventlog -logname application -newest 100
$events | select-string -inputobject {$_.message} -pattern "failed"

Copy and Try it

It depends on the if your allowed to see the event log or see you get following message.