Auto Restart Windows Service and alert if it fails
Regarding auto restart and alert for windows services. All posts lead to this URL: http://blog.mikesuding.com/2016/09/20/restart-a-service-alert-if-restart-fails/ However, the dataouce file’s no l...
A colleague's pointed out to me that this is available in LM Exchange , under Community - Windows Services Auto Restart
Anonymous
2 years ago
If you’re using the version from my github repo, you shouldn’t be setting the wildcard value. Instead, you should be setting the “Service_restart.services” 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.
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.