locked
Alerts in a specific View RRS feed

  • Question

  • Hi

    new to SCOM & Powershell

    Following code to select from all alerts  and close alerts from 3 specific rules but it is CPU intensive and thrash the cpu for upto 30sec.

    get-alert |where {$_.name -eq "AD Replication is occurring slowly" -or $_.name -eq "Script Based Test Failed to Complete" -or $_.name -eq "AD Client Side - Script Based Test Failed to Complete"  -AND $_.ResolutionState -eq 0} | resolve-alert

    How can I narrow down my search which is less resource intensive?

    Regards

    PS

     

    Friday, April 9, 2010 11:09 AM

Answers

  • Hi

    -criteria is more efficient than where ...

    Try the following to list all the alerts that meet the requirement (these are ALL single quotes ' just multiple times):

    get-alert -criteria 'ResolutionState=''0'' And Name=''Script Based Test Failed to Complete'''

    If that works for listing, add on each script name ... then try adding the resolve alert - I have just tested this and it works for me .. as usual with scripting .. use at own risk!

    Cheers

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Marked as answer by Pretlez Friday, April 9, 2010 11:53 AM
    Friday, April 9, 2010 11:51 AM

All replies

  • Hi

    -criteria is more efficient than where ...

    Try the following to list all the alerts that meet the requirement (these are ALL single quotes ' just multiple times):

    get-alert -criteria 'ResolutionState=''0'' And Name=''Script Based Test Failed to Complete'''

    If that works for listing, add on each script name ... then try adding the resolve alert - I have just tested this and it works for me .. as usual with scripting .. use at own risk!

    Cheers

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Marked as answer by Pretlez Friday, April 9, 2010 11:53 AM
    Friday, April 9, 2010 11:51 AM
  • Thanks Graham. Works very well
    Friday, April 9, 2010 11:53 AM