PowerTip: Use PowerShell 4.0 Where Operator to Filter

Doctor Scripto

Dr Scripto

Summary: Use Windows PowerShell 4.0 Where operator to filter results.

Hey, Scripting Guy! Question How can I use a Where operator in Windows PowerShell (without using the pipeline or Where-Object)
           to filter through processes?

Hey, Scripting Guy! Answer Use Get-Process  to group the processes into a collection, then use the Where operator
           and filter on the process name, for example:

(Get-process).Where({$_.ProcessName -eq 'winlogon'})

0 comments

Comments are closed.