BikeBoy20032004
MIS
This script is right out of the book, and is supposed to show all services running on local machine.
strComputer = "."
set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
Set colItem = objWMIService.ExecQuery ("Select * from Win32_Service")
for each colItem in colItems
Wscript.Echo objItem.Name
Next
I get an error:
Line:8
Char: 1
Object not a collection
Basically telling me that objItem is not a collection, but how can I fix it?
Thanks
strComputer = "."
set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
Set colItem = objWMIService.ExecQuery ("Select * from Win32_Service")
for each colItem in colItems
Wscript.Echo objItem.Name
Next
I get an error:
Line:8
Char: 1
Object not a collection
Basically telling me that objItem is not a collection, but how can I fix it?
Thanks