Contact Info

Crumbtrail

ActiveXperts.com » Support » Network Monitor » KB Article

Knowledge Base FAQ Item #7620025

 

Q7620025: I want to restart services after failure, but I want to do this dynamically, i.e. at runtime will be decided which services to start. How can I achieve this?

It is pretty easy: just write a small VBScript program and launch it when the check fails. You can use the following script as a base for your own script:

strRemoteComputer = "server05"
strService = "alerter"
For each Service in GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strRemoteComputer)_
    .ExecQuery("select * from Win32_Service where Name='" & strService & "'")
    Service.StartService
Next
(viewed: 1711)