-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
I can't find any way to do basic enumeration. While I can manually obtain the enumerator, it doesn't seem to support IDispatch interface (and my attempts to poke at it with available machinery quickly lead to VM crash).
I've tried to accomplish (as a starting point) the following:
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(".", "root\cimv2")
Set Products = objService.ExecQuery("SELECT * FROM Win32_Product")
For each Product in Products ' <-- this is what I can't figure out how to do
' ...
Next
In some cases, I can use Count and a numerical index to fake it, but SWbemPropertySet insists on using name as an index, or it can give you an enumerator.
So I can get at the properties if their name is specified beforehand, but I'd very much like to support cases like "give whatever WQL query, and the method will enumerate all the key/value pairs itself".
Maybe - if my assumption is correct & it will need COM enumeration interface support - it would be also nice to document it ("tutorial it" ?), it seems it would be a pretty small / isolated example of "how to support arbitrary COM interface".