This is a very minimal introduction into filtering pipeline objects using Where-Object and comparison operators. This video will give you the syntax and a simple example. To unleash the full capabilities of comparison operators take a look at the help file.
1 2 3 4 5 6 7 |
# Basic Syntax example Get-Service | Where-Object Status -eq Running # Advanced Syntax example Get-Service | Where-Object {$PSItem.Status -eq 'Running' -and $PSItem.StartType -eq 'Automatic'} # Same as above Get-Service | Where-Object {$_.Status -eq 'Running' -and $_.StartType -eq 'Automatic'} |