ArticleDirectory
- Class hierarchy
- Common WMI classes
In the final analysis, Using WMI is the access to WMI classes. How to find a proper class is a key step. I have been worried that I cannot find a proper class or namespace. Do you have such a problem?
Class hierarchy
WMI classes are organized in the namespace and inheritance hierarchy, and are in a tree structure. The root of the namespace is root, and there are more than a dozen namespaces under it. The most common one is Root \ cimv2. The namespace information is stored in the static _ namespace class. to query all namespaces in the current namespace, you can view the instances of the _ namespace class. The namespace queried by powershell on my machine is as follows:
PS c: \ Users \ idsswtt> Get-wmiobject-class _ namespace-namespace root |Select namename----SubtasksDefaultBytes
For more details about the namespace, you can write a recursive script to get it, or get it from WMI (2): How to Use the wmi cim studio tool mentioned in WMI.
Common WMI classes
The WMI architecture contains hundreds of classes. We often use only one part. Some of them are used to query instances, while others are used to query schema of classes. In addition to the _ namespace class mentioned above, we also use the _ win32provider class to query which functions are provided in the current system.Program. These two classes are system classes.
In addition, there are two types of WMI classes that we often use: CIM _ * and Win32. The former is the core class and public class of WMI, and is often referred to as the CIM core class and public class. The latter is a Win32 extension class. We query instances in Win32 extension classes. For example, Win32 _Product, win32_logicaldisk, etc.
WMI lookup manual?
Unfortunately, so far. I have not found a useful WMI class lookup manual. However, there is a classification on the Microsoft msdn website. We can query according to this category. The following links are frequently used by me. I hope you can use them here.
WMI reference
Win32 classes
WMI providers
Conclusion
After reading these things, if you still cannot find the class you want, you can only blame Microsoft. I think Microsoft is doing too little for WMI, at least in class queries. Before Microsoft invests more in WMI, we can only rely on experience and search engines to find appropriate classes.