Where are the classes in WMI in the WMI starter tutorial? _powershell

Source: Internet
Author: User
Tags static class win32

Using WMI in the final analysis is access to WMI classes, and finding the right classes is a key step. I've been worried about not finding the right class and namespace. Do you have such a problem, too?

Class hierarchy

WMI's classes are organized in namespaces and inheritance hierarchies, and are in a tree-shaped structure. The root of the namespace is root, and there are more than 10 namespaces underneath it, most commonly root\cimv2. Namespace information is stored in the static class __namespace class, and to query all namespaces under the current namespace, you can view instances of the __namespace class. The following are the namespaces that are queried on my machine using PowerShell:

Copy Code code as follows:

PS c:\users\idsswtt> get-wmiobject-class __namespace-namespace Root | Select Name

Name
----
Subscription
DEFAULT
cimv2
Cli
Nap
MicrosoftIISv2
Security
Smsdm
Ccmvdi
Rsop
Webadministration
Ccm
Wmi
Directory
Policy
Virtualization
Interop
Hardware
ServiceModel
Microsoft
Aspnet

For more information about namespaces, you can write a recursive script to get it, or start with WMI (ii): How to use the WMI CIM Studio Tools mentioned in WMI.

Common WMI Classes

There are hundreds of classes in the WMI architecture. Only a fraction of what we often use. Some of these are used to query instances, and others to query the schema of the class. In addition to the __namespace class mentioned above, we will also use the __Win32Provider class to query which providers are available in the current system. These two classes are system classes.

In addition, there are two classes of WMI classes that we often use: the Cim_* class and the Win32_* class. The former is a core class of WMI and a common class, often referred to as the CIM core classes and public classes. The latter is the Win32 extension class, and we query the instance more in the Win32 extension class. such as Win32_Product, Win32_LogicalDisk and so on.

WMI Class lookup manual?

It is a pity that so far. I didn't find a handy WMI class lookup manual. But on the Microsoft MSDN website, there is a classification. We can do the query according to this classification. Here are a few links I often use, posted here, I hope you can use.

WMI Reference

Win32 Classes

WMI Providers

Conclusion

Read the above I wrote these things, if you still can't find the class you want, then you can only blame Microsoft. I think Microsoft is still doing too little for WMI, at least in the class query. Until Microsoft invests more in WMI, we can only rely on experience and search engines to find the right class.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.