Filter objects from the pipeline, based on object properties.
Syntax
command | Where{test1 [conjunction test2]
Key
conjunction Any of the following: (logical boolean operators)
-and, -or (Logical or), -bor (Bitwise or), -band (Bitwise and), -xor
Test1 An expression that resolves to a Boolean (TRUE/FALSE) value.
Test2 An expression that resolves to a Boolean (TRUE/FALSE) value.
comparison operators
The expression can use any of the powershell comparison operators as long as the result is a boolean.
Also: -not logical Not (with ! as an alias) and -xor (Exclusive OR)
Examples
Lists files on drive f: greater than 1000000 bytes:
PS C:\>Get-ChildItem f:\ | where {$_.Length -gt 1000000}
“The enemy of art is the absence of limitations” - Orson Welles
Related Powershell Commands:
Where-Object - Filter input from the pipeline (Alias = where)