MSAcpi_ThermalZoneTemperature, as the name suggests, is queried through the Acpi management interface. Therefore, your system must have an Acpi hot zone to be able to ask, and The Acpi hot zone is actually a product designed by a laptop, there is no Acpi Hot Zone Design in the PC system.
Generally, Win32_TemperatureProbe is used on the computer for query. However, since Win32_TemperatureProbe is used to directly ask SMBIOS, it is determined by the motherboard manufacturer to determine whether SMBIOS supports WMI. That is to say, if the motherboard vendor supports WMI, you can use CurrentReading of Win32_TemperatureProbe to read the CPU quota. Unfortunately, most (almost all) motherboard vendors do not support this feature.
WMI's Windows Management specifications provide System, device, and application information. WMI information is obtained in the System. Management namespace provided in. NET. The following describes how to obtain the CPU temperature and serial number.
To use ManagementObjectSearcher object category, you must add System. Management to the reference before using it.
CPUtprt = = System.Management.ManagementObjectSearcher(, (System.Management.ManagementObject mo = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue().ToString()) - ) / = + CPUtprt.ToString() + = ManagementObjectSearcher( (ManagementObject mObject .label1.Text+=(mObject[
WQL is the Query Language in WMI. The full name of WQL is WMI Query Language (WQL for short). It can be translated into Chinese and become a standardized Query Language for Windows Management. Those who are familiar with the SQL language will feel that it is very similar to SQL.
WQL is actually very simple and has the following features:
1. Each WQL statement must start with SELECT;
2. SELECT is followed by the attribute name you want to query (I called it the field name for the corresponding SQL). You can also return all attribute values in the same way as SQL;
3. FROM keyword;
4. Name of the class to be queried;
5. In addition, you can add the WHERE clause if you want to accurately query the result. For example, if a class has the Enable attribute, you can add where enable = true during query.
Like this:
SELECT field name FROM Class Name
The following are all correct WQL statements:
Select * From Win32_LogicalDisk where drivetype = 3 ''' query all hard disk partitions
SELECT * FROM Win32_share ''to query all shared directories
SELECT * FROM Win32_NetworkAdapterConfiguration WHERE DHCPEnabled = TRUE
SELECT Description FROM Win32_Account WHERE Name = 'admin'
SELECT Freespace, DeviceID FROM Win32_LogicalDisk
In WinXP and Win2003, There Is a wql test tool named wbemtest.exe. You can use it to view which classes and classes have the following attributes:
First, run wbemtest.exe, for example:
Click "OK" and a window "Windows Management compliance tester" will appear, for example:
Click "Connect" to display a dialog box. You can choose to connect to the local host or remote host, for example:
If the test is performed on the local machine and you log on as an administrator, you do not need to enter the user name and password, to connect to a remote host, enter the user name and password on the remote host (You are advised to log on as an administrator on the remote host). Click "Connect" and the system will return to the main interface. Note: You can view and query data only after logging on.
Click "query" and enter the WQL statement to be queried, for example, "Select * From Win32_LogicalDisk". This is the WQL statement used to query the logical drive of the system,
This is probably because we will get an error with the number "0x80041010" and described as "invalid category", such:
This error occurs because the default namespace is "root \ default" at the beginning. In this case, we need to change the namespace. Click "Connect" to change the default "root \ default" to "root \ cimv2", and then click "Connect", for example:
After successfully logging on, we can view the classes in the system and execute WQL queries. Click the "enumeration category" button. In the displayed dialog box, enter the name of the class to be queried to query the attributes of the class. For example, (note: I did not enter the super class name and select the "recursive" radio button, which is used to recursively list all classes in the system ):
The query result is as follows:
These can be useful. If you are careful, you will find all the classes designed in the WQL statements that I used previously, such as Win32_LogicalDisk and Win32_share. Note that there are some parentheses. These are methods.
The following are some query results:
You can also double-click a data item to view the attributes, for example:
If we are not familiar with this method, we can also click the "show MOF" button in the window above, which is the result of my clicking "show MOF" button:
From the preceding examples, we can see the attributes and corresponding attribute values of this class.
Today's content seems to be unrelated to. net, but only by understanding and familiarizing ourselves with WQL can we quickly and smoothly write. net code.
For more information, see the following link:
The http://msdn.microsoft.com/zh-cn/library/system.management.managementobjectsearcher (v = vs.100)
Http://blog.useasp.net/archive/2013/06/15/the-tutorial-series-of-wql-that-the-sql-in-wmi-chapter-one-keywords.aspx
3. WQL class
In WMI, how many classes can we use for WQL queries? This Mitchell does not have specific statistics, but in common operations, it does not involve a lot of data, we can use tables to list the classes that are commonly used under Win32. The table is as follows:
With the WMI class, we can write WQL as needed to query various data in the system. For example, we want to know how many physical disks exist in the current system, the system disk instance can be returned as follows:
Win32_DiskDrive
If you need more information about these physical disks, you can find them from the obtained parameters. You can find the help documentation on MSDN for these parameters. Is it very convenient?