(Diagram: 淺談CIM與WMI-名詞介紹)

WMI (Windows Management Instrumentation) provide a kind of easy way to let you query data from your system (Ex: OS version, share folder name … etc).

It is easy to understand, using WMI to query information is the same with query data from database. You can just using “SELECT * from Win32_Process” to find out all exist process in your computer.

There are some examples which describe how to create it using C# or C++ code.

  1. Example: Creating a WMI Application(C++)

  2. WMI Sample  (using C#)

There are serveral extension reading..

Here is sample code of C#

using System.Management; //This is equivalent to "SELECT * FROM Win32_Service" SelectQuery sysSQL = new SelectQuery("Win32_bios"); > > MnagementObjectSearcher sysRet =    new ManagementObjectSearcher(sysSQL); > > // Display each entry for Win32_bios foreach (ManagementObject sysInfo in sysRet.Get()) {   this.textBox1.Text = "Bios version: " + sysInfo["version"].ToString(); } > >

Buy Me A Coffee

Evan

Attitude is everything