Skip to content

Instantly share code, notes, and snippets.

@ekmixon
Forked from signalwarrant/PS-Filtering.ps1
Created October 4, 2021 18:07
Show Gist options
  • Save ekmixon/f8b192bf3c5ae0ba0e66a6a5a77f0d5d to your computer and use it in GitHub Desktop.
Save ekmixon/f8b192bf3c5ae0ba0e66a6a5a77f0d5d to your computer and use it in GitHub Desktop.
PS-Filtering.ps1
# 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'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment