Where-Object
Select objects from a collection based on their property values. Note: This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/where-object.
- Filter aliases by its name:
Get-Alias | Where-Object - -
- List all services that are currently stopped. The
$_automatic variable represents each object that is passed to theWhere-Objectcmdlet:
Get-Service | Where-Object {$_.Status -eq "Stopped"}
- Use multiple conditions:
Get-Module -ListAvailable | Where-Object { $_.Name -NotLike "Microsoft*" -And $_.Name -NotLike "PS*" }
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
