none
adding a delay in a powershell script rule check RRS feed

  • Question

  • I have a situation that I need to write a PowerShell script to check to see if a particular service is down, wait 20 minutes, and check again, if still down, try to restart the service, sleep for 10 seconds, and check again, if the service is still down, write an event to the event log and monitor for that in a separate rule in SCOM to generate an alert.

    So would having a 20min sleep in a PowerShell script cause any unusual issues in SCOM? I realize this may be an unorthodox method, but I'm willing to entertain other ideas as well.

    Thanks

    Paul


    Paul Arbogast

    Monday, September 9, 2019 1:57 PM

All replies

  • Hi,

    For this situation, it is suggested to run the PS script in a scheduled task (via group policy, local policy, manually or other methods) and generate the event accordingly. This ensures the reliability.

    In the operations manager, we may create a rule based on the specific event ID. Steps as below:

    https://mytechguideblog.wordpress.com/2016/11/29/creating-event-based-alerting-rules-in-scom-2012/

    Hope the above information helps.

    Regards,

    Alex Zhu
    -----------------------------------------------
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
    Tuesday, September 10, 2019 1:20 AM
  • You can create a Rule which can utilise a PowerShell Script that can check this at the intervals you require then generate an alert if it meets the criteria

    Website: www.walshamsolutions.com Technical Blog: https://www.walshamsolutions.com/technical-blog Personal Blog: https://www.walshamsolutions.com/personal-blog Twitter: Dwalshampro

    Tuesday, September 10, 2019 10:54 AM
  • add match count / sample count logic to your Expression.Filter

    none

    Tuesday, September 10, 2019 12:56 PM
  • Hi,

    It seems there is no update for a couple of days. May we know the current status of the problem? Is there any other assistance we can provide?

    Regards,

    Alex Zhu
    -----------------------------------------------
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
    Friday, September 13, 2019 8:43 AM