>I can get the below code to enumerate my services OK, but I am getting no IntelliSense in my .prg if I type "? oService.".
>
>Is there a trick to getting IntelliSense to work with GetObject and collections, or is it just that WMI is a biotch?
>
>
>cHost = "."
>oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + cHost + "\root\cimv2")
>colServiceList = oWMI.ExecQuery("Select * from Win32_Service")
>For Each oService in colServiceList
> ? oService.Name
>Next
>
Steve,
See Tamar's message. Add Microsoft WMI Scripting V1.X Library to the Intellisense Manager under Types - Type Libraries. You can then define a variable as
local oService as WbemScripting.SWbemObject
However, even if you do this, I don't think you are going to get what you want.
A WMI object is a generic object with a property collection. You can access the collection via the Properties_ property of the object. The property collection holds a bunch of SWbemProperty objects. This object has a Name and Value property.
I say this because Intellisense will not bring up a list of properties associated with a Win32_Service. It will only bring up PEMs associated with the SWbemObjectSet, SWbemObject, SWbemPropertySet and SWbemProperty.
You can circumvent this limitation by inserting another for each loop inside the for each oService loop. Use:
for each oproperty in oService.Properties_
? oproperty.Name, oproperty.Value
next
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao