locked
Using powershell script in a rule to close all the alerts RRS feed

  • Question

  • Hi,

    I need to close all the New and critical alerts from the console every one hour. becuase no one is looking at the console in my setup. So i write a rule through Auth console in this way.

     

    get-alert -criteria ‘ResolutionState = ''0'' AND IsMonitorAlert = ''False''’| resolve-alert -comment 'Closing New alerts through script' | out-null

      Once i imported i got the below script error in teh ops console. I am thinking that i missed something when i wrote the rule. COuld you please point what went wrong in the script? 

    The Event Policy for the process started at 4:45:00 PM has detected errors in the output. The 'ExitCode' policy expression:
    [^0]+
    matched the following output:
    1

    Thanks in Advance,

    Fidelis

     

    Create New Rule --> Timed COmmand --> command --> and pasted the below powershell script  as CloseAlert.PS1 and imported the MP .
    Sunday, June 20, 2010 5:10 PM

Answers

  • what this means is that the exit code was a 1 instead of a zero.  The command probably didn't work because you need to load it into powershell instead of cmd.exe.  
    Microsoft Corporation
    • Proposed as answer by Vivian Xing Monday, June 28, 2010 8:17 AM
    • Marked as answer by Vivian Xing Monday, June 28, 2010 8:17 AM
    Monday, June 21, 2010 2:16 AM