Here is a script to check a Windows service status, force stop the processes and restart if it is stopped, and write results to log.  We had a problem where Hamachi would stop unexpectedly.  This example shows a check of the Hamachi service.  Both the LogMeInHamachi Tunneling Engine and LMIGuardianSvc are necessary services.  Create a recurring scheduled task with this script as the executable.

net start “LogMeIn Hamachi Tunneling Engine” 2>&1|Find “2182”
If errorlevel 1 call :dostuff
Echo %date% %time% Hamachi Service Already Started >> C:\ScriptsBats\CheckHamachi\log.txt
exit

:dostuff
Net Stop “LogMeIn Hamachi Tunneling Engine”
Net Stop “LMIGuardianSvc”
taskkill /f /im LMIGuardianSvc.exe
taskkill /f /im hamachi-2.exe
net start “LogMeIn Hamachi Tunneling Engine”
ping google.com -n 5
net start “LogMeIn Hamachi Tunneling Engine” 2>&1|Find “2182”
If errorlevel 1 call :errors
Echo %date% %time% Forced stop start worked and Hamachi has been fixed >> C:\ScriptsBats\CheckHamachi\log.txt
exit

:errors
Echo %date% %time% We tried to force stop and start but errors occurred >> C:\ScriptsBats\CheckHamachi\log.txt

 

Here is a log of results:
Windows Service .bat script Status Check