L
Leszek
Hello!
I wrote a simple code to query WMI about few elements.
I'm trying to query it like SELECT my_definied_element FROM anyclass. Not
"*".
Can anyone help me? I know, that problem is with WMI collection...
Dim searcher As New ManagementObjectSearcher(provider, calosc)
Dim provider as string = "root\cimv2"
Dim wartosc as string() 'contains FreeSpace, Caption, Size, VolumeName
Dim element as string = ""
Dim calosc as string = "select FreeSpace, Caption, Size, VolumeName from
Win32_LogicalDisk where DriveType = '3' "
For Each queryObj As ManagementObject In searcher.Get()
'------------------------version A - working----------------------------
xmlWrite.WriteElementString(element, queryObj("Caption"))
xmlWrite.WriteElementString(element, queryObj("FreeSpace"))
'------------------------version B - not working - should------------
'For Each element In wartosc
'console.writeline(queryObj(element))
'console.writeline(---------------------------)
'Next
Next
I wrote a simple code to query WMI about few elements.
I'm trying to query it like SELECT my_definied_element FROM anyclass. Not
"*".
Can anyone help me? I know, that problem is with WMI collection...
Dim searcher As New ManagementObjectSearcher(provider, calosc)
Dim provider as string = "root\cimv2"
Dim wartosc as string() 'contains FreeSpace, Caption, Size, VolumeName
Dim element as string = ""
Dim calosc as string = "select FreeSpace, Caption, Size, VolumeName from
Win32_LogicalDisk where DriveType = '3' "
For Each queryObj As ManagementObject In searcher.Get()
'------------------------version A - working----------------------------
xmlWrite.WriteElementString(element, queryObj("Caption"))
xmlWrite.WriteElementString(element, queryObj("FreeSpace"))
'------------------------version B - not working - should------------
'For Each element In wartosc
'console.writeline(queryObj(element))
'console.writeline(---------------------------)
'Next
Next