Forum Discussion

RichB's avatar
2 years ago

Auto Restart Windows Service and alert if it fails

Regarding auto restart and alert for windows services.  All posts lead to this URL:

However, the dataouce file’s no longer there.

Can anyone point me to where I can find a copy, or if there’s a newer option/solution?

  • A colleague's pointed out to me that this is available in LM Exchange , under Community - Windows Services Auto Restart

8 Replies

  • A colleague's pointed out to me that this is available in LM Exchange , under Community - Windows Services Auto Restart

  • For those struggling to find it like me, I was able to locate it by just filtering Datasources and using the word “restart.” Its locator is also MK7HKE.

  • If you’re using the version from my github repo, you shouldn’t be setting the wildcard value. Instead, you should be setting the “” property. What’s in the Exchange was submitted by Jake, an LMer who is no longer maintaining that module.

    The wildvalue of each instance (what should be in that property) needs to be whatever is needed by the `Get-Service -Name $service -ComputerName $hostname` command. Apparently, that -Name parameter will take either the long name or the short name, so it should work either way. 

    Seems to work with long name or with short name.

    Something to realize, this does not restart a service that is running. It only starts a service that is supposed to be running. If the service is already running when you do a poll now, it will return a result code of 1, meaning that it was already running.

  • So the instructions on the Github link and blog are a little unclear. I was able to test it with a few different services and it worked for me. However, the instructions make it sound like you should use the shortened “Service name” for the wilcard value. Instead, when I used the “Display name” as the wildcard value, it worked as expected. It takes a few polls but you can also do a manual poll anytime and it should reset it that way too which is kind of nice because it’s like a button you can press without having to login to the actual server. Not saying it will work for everything but it did work for the few I tried after I made those adjustments.

  • This is old but might do what you want/need. I tried to post the code in a code block, but the forum software kept kicking back a something went wrong message.

  • I searched for this in LM Exchange and do not see anything. Do you know if it’s still available and just listed differently or in a different spot now that Exchange is using uiv4?

  • I was informed that this datasource is outdated and will not work properly.