Skip to content

Instantly share code, notes, and snippets.

@signalwarrant
Created March 9, 2021 18:33
Show Gist options
  • Select an option

  • Save signalwarrant/e563a644bc8ce54b6f263a334c965d73 to your computer and use it in GitHub Desktop.

Select an option

Save signalwarrant/e563a644bc8ce54b6f263a334c965d73 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