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.