WMI introduction (1): What is WMI

Source: Internet
Author: User

WMI has been around for more than 20 years, but many people are not familiar with it. I know it is very powerful, but I don't know where it comes from, how it works, and what scope of use it is? Now let me talk about my understanding...

WMI has a set of APIs. Whether we use VBscript, powershell script, or C # To access the WMI class library, it is because of a group of Apis exposed by WMI. These APIs are installed when the WMI module is installed in the system. With these APIs, we can get the classes we want.

WMI has a repository. Although most of the instance data of WMI is not stored in WMI, WMI does have a repository to storeProgramThe provided class information, or the blueprint or schema of the class.

WMI has a service. WMI is always able to respond to user access, because it has a Windows service that is always running and its name is Winmgmt. Stop this service, and all operations on WMI will not respond.

WMI is scalable. Everyone knows that WMI can do a lot of things, read the hard disk information of the Local Computer, read the user information of the remote computer, read the domain user information, and so on. Basically, you can think of operations to retrieve or change resources. It can be said that you eat less and do more. Why is it so competent? This is based on WMI scalability. The operations that WMI performs on resources are not implemented by itself, but entirely dependent on the provider registered with it.

WMI is one of the essential tools for administrators and a script companion. Of course, a large system can also be built on the WMI and WMI providers. Here are two examples of Using WMI:

Example 1:

This example uses VB script to check the physical memory volume of the local machine:

Strcomputer = "  .  " Set Wbemservices = GetObject ( "  Winmgmts :\\  " & Strcomputer)  Set Wbemobjectset = wbemservices. instancesof ( "  Win32_logicalmemoryconfiguration  "  )  For   Each Wbemobject In Wbemobjectset wscript. Echo  "  Total physical memory (Kb ):  " & Wbemobject. totalphysicalmemory  Next 

Example 2:
In this example, powershell is used to check the logic hard disk of the local machine:

 
PS c: \ Users \ v-lukez> Get-wmiobject-class win32_logicaldisk

Conclusion:
WMI is very powerful and has been developing. However, it has never been warm because there are not many users. We hope that more people will be able to see the potential.

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.