Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Select-String

Select-String - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Select-String

Description
Search through strings or files for patterns

Usage


Options


Example(s)
Perform a case sensitive matching of literal strings:

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

Search through all files with the .xml file extension in the current directory and displays the lines in those files that include the case sensitive string "Princess":

PS C:\>select-string -path *.xml -pattern "Princess" -casesensitive

Retrieve the last 100 events from the application event log and filter to show only those containing the message string "failed":

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