SCOM monitor recovery task does not work

Bojan Zivkovic 581 Reputation points
2025-04-08T07:56:23.88+00:00

Hi, I have created service monitor (testing on Spooler service) using Windows Service template. Having done that, I configured simply one-liner PS script to start stopped service (as recovery task), but it never works for some reason. I tried both of these but still service is not getting started by recovery task:

Get-Service -Name $Target/Property[Type="SystemCenter1!Microsoft.SystemCenter.NTService"]/ServiceName$ | Start-Service

Get-Service -Name Spooler | Start-Service

How to troubleshoot this?

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,577 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Graham 176 Reputation points
    2025-05-03T08:39:36.5766667+00:00

    You can't use PowerShell in the SCOM Authoring wizards.

    Options:

    1. Use VBScript

    Set wmi = GetObject("winmgmts://./root/cimv2")

    Set svc = wmi.Get("Win32_Service.Name='Spooler'")

    rc = svc.StartService

    1. Download the Community PowerShell MP from SquaredUp \ Cookdown - https://ds.squaredup.com/cookdown/powershell-mp/ - and use the PowerShell recovery that this provides. You code will work fine albeit the service name is hard-coded.

    Get-Service -Name Spooler | Start-Service

    For completeness, depending on your settings, just auto-starting the service risks an endless of loop of the service stopping, the recovery auto starting it etc. so it is best to include some logic in your PowerShell script (or VB Script) to only restart a set number of times.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.