Microsoft's article, ManagementBaseObject.Properties
Property, shows how to enumerate the properties in a collection
For Each p As PropertyData In properties
Console.WriteLine(p.Name)
For Each q As QualifierData In p.Qualifiers
If (q.Name.Equals("Description")) Then
Console.WriteLine(processClass.GetPropertyQualifierValue(.Name, q.Name))
End If
Next
Console.WriteLine()
Next
End Function
And This article http://msdn.microsoft.com/en-us/library/ms257359.aspx demonstrates retreiving info from WMI.
What I am trying to do is run a WMI query like "SELECT * FROM Win32_Environment". But I can't seem to enumerate through the collection because envVar is not a PropertyDataCollection:
Dim query As New ObjectQuery(strQuery)
Dim searcher As New ManagementObjectSearcher(scope, query)
For Each queryObj As ManagementObject In searcher.Get()
s = s & queryObj("Name").ToString() & ": " & queryObj("VariableValue").ToString()
Next
How do I enumerate through this collection without knowing the names? I can't seem to get it to work since queryObj is not a collection.