0
I created a vbs script to restart the service if it is stopped. However it does not work, I tried to do a by . bat more without including in the schedules tasks.
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")
For Each objService in colRunningServices
if (objService.State="Stopped") and (objService.DisplayName="Print Spooler") then
Wscript.Echo "Service Status: "& objService.State &""
objService.StartService()
end if
Next
Is it a requirement to use vbs? Or can you do it some other way?
– Fabricio
can be made another way, the vbs and batch were attempts, at first I thought it was the code.
– Bruno Rodrigues