Update 11/15/2009: Yeah, yeah you are probably
saying. Fluff – or perhaps I already know this
stuff. Our only response is yep, you probably
do. This is just a classic example on how to use
wmi via the cimv2 repository to attach and
enumerate services locally or remote via
win32_service.
Description
Returns a list of all inactive services on a
computer (that is, a list of all the
services that are installed but are not
running).
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colStoppedServices = objWMIService.ExecQuery _
("SELECT DisplayName,State FROM Win32_Service" &_
" WHERE State <> 'Running'")
For Each objService in colStoppedServices
Wscript.Echo objService.DisplayName &_
" = " & objService.State
Next