Simple question i believe, but cant understand why my single liner do not print any output. I want ot filter Objects only with resolutions state (0 = new), and Owner area which is blank (not assigned). So i thoght that if it will be null, or i am understadnign not correctly. Thanks for any advice.
Get-SCOMAlert -ComputerName dbdtScomProd | Where-Object {$_.ResolutionState -eq “0” -and $_.Owner -eq “NULL”}
If you want to use a null value in a where-object statement, use
Get-SCOMAlert -ComputerName dbdtScomProd | Where-Object {$_.ResolutionState -eq “0” -and $_.Owner -eq $null}
You may also want to look at using Get-SCOMAlert -Criteria
As an example:
Get-SCOMAlert -Criteria "ResolutionState = 0 AND Owner IS NULL"}
Using Measure-Command
in my environment, I see Criteria take 0.6 Seconds and the Where-Object
command take 5.1 Seconds.