A lot of time you want to filter your results from Get-* command in Powershell. One way to do will be to pass the results from Get-* command through two where-object pipe lines. Or you can take advantage of logical operators to combine more than one filter in one where-object FilterScript. For example I wanted to get list of processes on my server that are using more than 2MB of memory or have more than 400 file handles open. Following command shows how two filters were combined.
get-process | where {($_.WorkingSet -gt 1024*2048) -or ($_.HandleCount -gt 400)}Following is list of logical operators that are available in PowerShell.
Logical Operator | Meaning |
-and | Logical and; true if both sides are true |
-or | Logical or; true if either side is true |
-not | Logical not; reverses true and false |
! | Logical not; reverses true and false |
Combining more than one filter in where-object filtering in Powershell
Resolve Sequence contains more than one matching element error
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2025 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use