Can someone let me know if it is possible to create a run a vb script to check if a process is running, if the process is not running then restart (stop then start I guess) a Windows service?
My example VB script is here, just wondering if this can be used with a PRTG sensor to automate the recovery:
strComputer = "localhost" Set wbemServices = GetObject("winmgmts:\\" & strComputer) Set wbemObjectSet = wbemServices.InstancesOf("Win32_Process") Set objShell = WScript.CreateObject("WScript.Shell") for each wbemObject in wbemObjectSet If wbemObject.Name = "notepad.exe" then wscript.quit End If next objShell.Run("sc \\" & strComputer & " stop wuauserv && sc \\" & strComputer & " start wuauserv")
Thanks
Hello,
thank you very much for your KB-Post. This should be possible by monitoring the process with a WMI Process Monitor and then using the solution of the following KB-Article to restart the service: Restart a remote service
best regards.
Jul, 2013 - Permalink