You are here: > PowerShell > PowerShell 1.0 > Select-String
ActiveXperts Network Monitor 2015 proactively manages network servers, devices, databases and more.

Select-String - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.


-pattern string
       The string or regular expression to match.

   -text string
       Literal text to match against the value of -Pattern.
   -Path path
       Strings or files to match against, wildcards are allowed.

   -include string
       Include only the specified items from the Path. e.g. "May*"
       this only works when the path includes a wildcard character.
   -exclude string
       Omit the specified items from the Path e.g. "*SS64*"
       this only works when the path includes a wildcard character.

        Use a simple match, rather than a regular expression match

       Make the matches case sensitive.
       Suppress most of the output from Select-String.  
       When specified, only a boolean value is passed along the pipeline. 
       TRUE = a match was found, otherwise FALSE.
       Only return info. about the first match from each input file.
   -inputObject psobject
       Accept an object as input to Select-String. Enter a variable,
       command or expression that gets the objects.

      -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

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"