Getting Started with WMI (i): what is WMI

Source: Internet
Author: User

WMI has been present for more than 20 years, but many people are not familiar with it. Know it is very good and powerful, but do not know where it comes from, how to work, what is the scope of use? Now I'll talk to you about my understanding ...

WMI has a set of APIs. Whether we use VBScript, PowerShell scripting, or a C # access to WMI's class library, it's a set of APIs that WMI exposes out of the way. These APIs were installed when the system installed the WMI module, and through them we were able to get the class we wanted.

WMI has a repository. Although most instance data for WMI is not stored in WMI, WMI does have a repository that holds the class information provided by the provider, 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 running Windows service, named WinMgmt. Stop this service and all operations on WMI will not respond.

WMI is extensible. Everyone knows that WMI can do a lot of things, read local hard disk information, read user information from a remote computer, read domain user information, and so on. Basically, you can think of getting or changing the operation of a resource, it is capable. Eat less and do much. Why is it so capable? This is based on the scalability of WMI. The operation of WMI on a resource is not what it implements itself, but depends entirely on the provider to which it is registered.

WMI is one of the most powerful tools an administrator has to do every day and is a scripting companion. Of course, you can also build a large system on top of WMI and WMI providers. Here are two examples of using WMI:

Example one:

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

StrComputer = "." Set wbemservices = Getobject ("winmgmts:\\" & strComputer) Set wbemObjectSet = Wbemservices.instancesof ("Win32_ LogicalMemoryConfiguration ") for each wbemobject in wbemObjectSet    WScript.Echo" Total Physical Memory (KB): "& WB Emobject.totalphysicalmemorynext

Example two:
This example uses PowerShell to check the local logical hard disk condition:

PS c:\users\v-lukez> Get-wmiobject-class Win32_LogicalDisk

Conclusion:
WMI is powerful and has been evolving, but it has been tepid because of the few people who use it. I hope more people can see the potential of the beads.

Getting Started with WMI (i): what is WMI

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.