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
Add comment