How to create a Recovery task in SCOM on a windows service.

When you have the requirement to monitor a windows service through Microsoft’s System Center Operations Manger and have it restarted automatically you can not use the management pack templates. The reason for this is that the templates are stored in locked MP’s that you do not have access too.

Follow the following steps to monitor a service and have it restarted automatically by SCOM if it fails.

Steps

  1. Create a management pack to store the monitor in
  2. Create a group that the monitor will be applied against
  3. Create a monitor that watches the service
  4. Create overrides (apply to group)
  5. Create the recovery task

Step 1: Create the Management Pack

In the managment console under Administration right click on Management Packs and select “Create Management Pack”. Give this new MP a meaningfull name and continue.

Step 2: Create the Group

  • In the Authoring Pane right click on “create new group” Give this new group a meaningful name. A description. And select the management pack that you created.

Important: Do not use the default management pack. You can do it. But this will create problems when trying to remove MP in the future. Always use Custom MP’s.

  • Say next. Click on Add/remove objects on the Explicit Group Members. Enter a server name and search. Select your computer object and say ok. You can now add dynamic and exclusions. I am not going into that on this post so except all defaults.



Step 3: Create the Monitor

  • In the Authoring Pane right click on monitors and select Create a monitor, then Unit Monitor.

  • Expand Windows Services, and select “Basic Service Monitor”. Select the custom management pack.

  • Provide a name for the monitor. I am going to create this monitor to watch Windows Update services. Select the monitor target as windows Server Operating System. Select the Parent Monitor as Availability.

  • Next Browse to the server, or any server with the service running. and select the service.

  • The next window shows how the monitor sees the health state. Accept the default.
  • The last window is how the alerts are configured.

  • uncheck the “Generate alerts for this monitor:” for now. This will prevent any unwanted alerts until we are ready.

Step 4: Apply to group

Lets apply this MP against the group that we created earlier and disable it for all other servers.

Fist disable the rule for all servers

  • Find the new rule under Authoring\monitors. The easiest way to do this is to change your scope. Click on the Change scope in the top right corner
  • Look for windows server operating System and select it and say ok.


  • Expand the monitor, right click on it and select properties.

  • Select Disable and “For all objects of type: windows Server Operating System”

  • Next Right click on the same monitor and select override, Override the Monitor, for a group

  • Start to type the name of the group you created and select it.
  • Place a check beside “Parameter name”. Change the override setting to True. This will enable the rule for the group.

  • Say OK to save.

STEP 5: Create Recovery Task

  • In the Authoring Pane right click on monitors and select the monitor you created by right clicking on it and select properties.
  • Click on the Diagnostic and Recovery Tab
  • Under the configure recovery Tasks select Add… and choose “Recovery for Critical Health State”
  • Select Run command
  • Provide a meaningful name and description
  • Select the recovery target as Windows server operating system
  • Check run recovery automatically and recalculate monitor state.

  • Next, for the full path to the file type C:\WINDOWS\system32\net.exe This will spawn the net command
  • for the parameters type start service name. We are starting windows update service. Here is the best way to find the service name. Open services by opening the run box and type services.msc

  • now that you have the actual service name lets enter it in the parameters field. so you would type “Start wuauserv”

  • Once you have clicked on create you are done.

Comments

12 Responses to “How to create a Recovery task in SCOM on a windows service.”

  1. J Tapiero on February 13th, 2009 9:05 pm

    Awesome article, thanks a lot Brad.
    Jorge.

  2. Brad Hearn on February 21st, 2009 4:51 am

    No problem, as long as it helped.

  3. Mike on April 29th, 2009 3:53 pm

    I agree with Jorge. Exactly what I needed to know.

  4. Ameen on August 5th, 2009 1:13 pm

    I tried to implement this solution on print service at SCOM server.
    But service still doesnt start.

  5. Brad Hearn on August 5th, 2009 2:56 pm

    Ameen, what are you using in your parameters field?

  6. Phil on August 14th, 2009 6:03 pm

    Nice Job – easy to follow and accurate
    Exactly what I was trying to do

  7. Chuck Hughes on August 28th, 2009 3:58 pm

    I can honestly say that this is the most precise ,clearest SCOM “How To” I have ever used. Thanks

  8. Da Blizump on October 12th, 2009 6:21 pm

    Saved as a favorite for quick reference. Perfect write up.

  9. John Bradshaw on November 19th, 2009 7:21 pm

    Thankyou for makng this so clear.
    How would you Stop and Start a service? Is a PS or bat script then necessary?
    Thx,
    John Bradshaw

  10. Torben Andersen on November 26th, 2009 3:16 pm

    Hi,

    How do you restart services on a server in the DMZ?

    “Next Browse to the server, or any server with the service running. and select the service.” – the server is not in the AD !

  11. Brad Hearn on December 15th, 2009 1:53 pm

    Torben,

    You can connect to any server to select the service if you like, this is only here to simplify this process and to help us avoid spelling errors. It is not necessary to connect the the actual server that you are planning on running the task against in the process of creating the task.. You may also type the service name in manually if you like. The recovery task will work on the DMZ machine using the runas account that you have created for it.

    Hope this helps
    Brad

  12. WHRKit on March 22nd, 2010 7:55 pm

    Thank you. I wish the documentation and the books I have would describe it in such clear instructions. This is a life saver for me at this point. I have servers that seem to let services die mainly after hours or on weekends – so, this should give me more sleep, too. :-)

Got something to say?

You must be logged in to post a comment.