ActiveXperts Knowledge Base Article 7620025

Our mission at ActiveXperts Software is to deliver high quality Network Monitoring solutions and Windows Development components. Our goal is to supplement these solutions with timely support resources that can help at many different levels.
The first thing you want to do is try to find the answer to your problem in the Knowledge Base. If you cannot find an answer to your question in our Knowledge Base, or if you need additional information or assistance, please use our Contact Support form.


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

If you cannot find an answer to your question(s) in our Knowledge Base, or if you need additional information or assistance, please contact our Customer Support using our Contact Support Form

M