Navigation: thinBasic Modules > WMI > WMI_GetData |
|
Description
General function to return all possible info about a WMI class name for a given computer.
Syntax
sBuffer = WMI_GetData(sComputername, sNameSpace, sUserName, sPassword, sClassName [, sWhere [, sFields]])
Returns
String
sBuffer is a sequence of $CRLF separated strings containing info name and value.
To be able to parse returned information, see below example.
Parameters
Name |
Type |
Optional |
Meaning |
sKey |
String |
No |
Computer name |
sNameSpace |
String |
No |
name of the namespace that provides support for the needed class |
sUserName |
String |
No |
in case of remote login. Better to specify it in the form "domain\user" |
sPassword |
String |
No |
if sUserName is specified, enter here user password |
sClassName |
String |
No |
Class name. See WMI class names list for the list of available classes |
sWhere |
String |
Yes |
WHERE clause. This field is used to Indicate some selection restrictions. Example: "DeviceID = 'C:'"
|
sFields |
String |
Yes |
String containing the names of the information to be returned. More info names can be indicated separated by a comma (,). Example: "Name, Size"
|
Remarks
Not all classes can be available.
Restrictions
See also
Examples
USES "WMI"
USES "OS"
USES "CONSOLE"
Dim vData() As String
Dim nItems As Long
Dim Counter As Long
Dim ComputerName As String VALUE 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
© 2004-2008 thinBasic. All rights reserved. | Version 1.7.0.0 | Web Site: http://www.thinbasic.com |