PDA

View Full Version : Help file: thinBasic Modules > WMI > WMI_GetData



Petr Schreiber
16-04-2011, 12:20
Hi,

it seems the example code listed under thinBasic Modules > WMI > WMI_GetData uses wrong syntax. Here is modified version, which should work.



Uses "WMI", "OS"
Uses "CONSOLE"

Dim vData() As String
Dim nItems As Long
Dim Counter As Long
Dim ComputerName As String = OS_GetComputerName
Dim sBuffer As String

' -- Ask data to WMI system
sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_LogicalDisk", "DeviceID = 'C:'" )

'sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_StartupCommand", "", "Command" )
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_LogicalDisk", "DeviceID = 'C:'", "Name, Size" )
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_Battery")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_LogicalDisk")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_NetworkAdapter")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_StartupCommand")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_Processor")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_DiskDrive")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_BIOS")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_CodecFile")
'sBuffer = WMI_GetData(ComputerName, "", "", "", "CIM_LogicalDisk")

' -- Parse returned data into single lines
nItems = Parse( sBuffer, vData(), $CRLF)

'---Print lines
For Counter = 1 To nItems
Console_WriteLine vData(Counter)
Next

'---Finished
Console_WriteLine "-----------------------------------------------------"
Console_WriteLine "Number of lines: " & nItems
Console_WriteLine "---------------------------Press a key to finish-----"

Console_WaitKey



Petr

ErosOlmi
15-05-2011, 10:47
A bit late but next update will have this example amended.

Thanks
Eros

Petr Schreiber
15-05-2011, 12:20
Thanks a lot!:)