0

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”}

1 Answers1

1

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.

user4317867
  • 2,397
  • 4
  • 31
  • 57
  • Thank you very much it worked! thanks. I definetly will try to dig deeper in these commands, thanks for advices, and solution! –  Jun 05 '16 at 02:02
  • Happy to help! It's very helpful to browse TechNet.Microsoft.Com for powershell commands, often there are articles written by Microsoft that offer TONS of helpful tips! – user4317867 Jun 05 '16 at 02:19
  • I am trying to google it, and reading microsoft technet, but not all the time everything can understand. And then i am stuck, i am asking for this community to help :) –  Jun 05 '16 at 03:04
  • What is helpful to me is using PowerShell's help `Get-Help Get-SCOMAlert -Full` to see the examples, then searching for more examples online. – user4317867 Jun 05 '16 at 15:11