WMI - Windows Management Instrument, is an object-oriented database based on Web based Enterprise Management (WBEM), a standard interface that manages corporate environment development. You can use it to access some of the information and services of the local host, monitor your computer, manage remote computers ...
Add a reference in vs.net: System.Management.dll, so your project can use WMI.
WMI is flexible, but Class is also more, such as: CPU's series number -Win32_processor, motherboard BIOS series number -Win32_bios, local disk -Win32_LogicalDisk, shared resources --Win32_share, etc., detailed WMI class name can be queried in MSDN MSDN -help: //ms.vscc.2003/ms.msdnqtr.2003feb.2052/wmisdk/wmi/win32_classes.htm
You can also use WMI Tools to manage WMI service namespace namespace http://www.microsoft.com/downloads/details.aspx?familyid=6430f853-1120-48db-8cc5-f2abdc3ed314&displaylang=en
Use this program to get WMI Class Name:
-------------------------------------------------- -------------------------------------
DIM WMI As Management.ManagementClass
DIM INFO As Management.ManagementObject
'Return to WMI Class Name to String Array
Private function findwmi (byval indexstring as string, byval deep as boolean) AS String ()
Try
DIM _WMILIST () AS STRING
WMI = New Management.ManagementClass, MANAGEMENTCLASS
DIM OPTIONS AS New Management.EnuMerationOptions
Dim chclass as string = Nothing
IF not indexstring is nothing then
CHCLASS = indexstring
END IF
Options.enumerateDeep = Deep
For Each Info in WMI.GETSUBCLASSES (OPTIONS)
IF _Wmilist is nothing then
Redim _wmilist (0)
Else
Redim preserve _wmilist (ubound (_wmilist) 1)
END IF
If chclass is nothing then
_WMILIST (ubound (_wmilist)) = (Info.ientm ("__ class")))
Else
IF info.item ("__ class"). Tostring.Substring (0, _
IIF (Info.item ("__Class"). Tostring.Length> Chclass.length, _
Chclass.length, info.ientm ("__ class"). TOString.Length)). TOLOWER = chclass then
_Wmilist (ubound (_wmilist) = (Info.ientm ("__ class")) endiff
END IF
Application.doevents ()
NEXT
Options = Nothing
INFO = Nothing
WMI = Nothing
Return_wmilist
Catch exception
MsgBox (ex.Message, 16 0, ex. Targetsite.name)
END TRY
END FUNCTION
'Get the WMI Class INFO and write it to the output window
Private sub getinfo (byval indexstring as string)
Try
IF indexstring is nothing thrings
DIM WMICLASS AS STRING = IndexString
WMI = New Management.ManagementClass (WMICLASS)
DIM STRINFO AS STRING
Console.writeline ("WMI Class is:" & WMICLASS)
For Each Info in WMI.GETINSTANCES
'Write WMI Class INFO to the output window
Console.writeline (Info.getText (Management.TextFormat.mof) .tostring)
NEXT
INFO = Nothing
WMI = Nothing
Catch exception
MsgBox (ex.Message, 16 0, ex. Targetsite.name)
END TRY
End Sub
-------------------------------------------------- -------------------------------------
when using it:
DIM TMPSTR () AS STRING, I AS INTEGER
'Get the Class Name of WMI
TMPSTR = FindWMI (Nothing, True)
'List 559 of Class 559 in Class Name Array Info
GetInfo (Tmpstr (559))
'Lists information about physical memory
GetInfo ("Win32_PhysicalMemory")