Stopping a service and waiting in VBScript

Posted by BrettS on Stack Overflow See other posts from Stack Overflow or by BrettS
Published on 2010-05-21T18:24:50Z Indexed on 2010/05/21 20:20 UTC
Read the original article Hit count: 155

Filed under:
|

How can I stop a service and wait for it to finish stopping in vbscript?

I've got this so far:

For Each objService in colServiceList
    If objService.DisplayName = "<my display name>" Then
        objService.StopService()
    End If
Next

Googling turned up a suggestion of using objService.WaitForStatus( ServiceControllerStatus.Stopped ), but running that gives me an error of "Object required: 'ServiceControllerStatus'".

© Stack Overflow or respective owner

Related posts about vbscript

Related posts about Services