'Start Service
strServiceName = "Alerter"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StartService()
Next
'Stop Service
strServiceName = "Alerter"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StopService()
Next
"'Start Service
strServiceName = "Alerter"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
objService.StartService()
Next"
did not start the service when the service stopped probably due to my inability to apply it well.
This is HOW I applied it: I copy the "Start Service" part of it and saved as vbs on cdrive on the local system,
I went to services, Right click on the service (alerter), select properties, recovery, first failure, run a program, browse to the program on the local cdrive, apply,ok.
I discover that the service has stopped the following day.
I expected that the script will start the service immediatelly it stops.
Kindly advice probably, I did not apply it well.Note that I only use 'Start Service and not 'stop service.
But if that doesn’t work there is a very big change the script won’t be able to start the service either!
Check the eventlog for errors; it should state the exchange service stopped and it should also state why it could not restart the service. It should be an information type in the system section.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.