Reputation: 12526
I have been reading a bit about WMI, and trying to get a handle on what it is, but it all seems like a lot of jargon and circular definitions.
Here: Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems.
An "infrastructure"? Huh?
Is it just some hooks into the operating system for accessing system resources, devices? What? If so, what is it made of? Are these COM classes?
WHAT IS WMI?
Upvotes: 5
Views: 1140
Reputation: 141668
Well, WMI is a system that allows querying information about a machine. WMI is made up of many different providers and classes, and each class can have properties and methods on it, not so much unlike .NET. Providers are responsible from returning classes.
You can query WMI either locally, or remotely. That's why it's considered a management infrastructure. An IT staff can use WMI to get information and perform actions with WMI remotely. For example, if you wanted to know what kind of drives was on the machine, you could run a WQL query like this:
SELECT * FROM Win32_DiskDrive
That would return a collection of Win32_DiskDrive and tell you information about it. Since they are objects, they have methods on them too.
Sometimes, WMI can tell you information about an environment that you can't get that information elsewhere, like when using Win32_Mainboard to get information about the motherboard.
3rd party developers might write their own WMI providers and classes to allow their application to be managed using WMI, something an IT person is likely already familiar with and they don't want to reinvent the wheel.
A Provider is a COM Object that acts between WMI and a management object/class. Classes are defined in the MOF (Managed Object Format). So the underlying thing is a provider is registered as a handler for the class, and when information from that class is asked for, the provider is fired up. Like .NET, management objects are scoped and defined in namespaces. The bulk of Microsoft's are in \ROOT\cimv2
.
The provider will implement the interfaces IWbemProviderInit
and IWbemProviderInitSink
. There is some good details on that here
Since it is a COM object, it is possible to write a WMI Provider in .NET and use ComVisible
to expose the provider.
Once you've developed it, you need to register it. You might also consider registering it before development it to aide debugging.
Microsoft has a simple example at http://msdn.microsoft.com/en-us/library/aa393677(v=vs.85).aspx.
Upvotes: 8
Reputation: 2701
I think technet FAQ might be helpful a bit.
The word “Instrumentation” in WMI refers to the fact that WMI can get information about the internal state of computer systems, much like the dashboard instruments of cars can retrieve and display information about the state of the engine. WMI “instruments” by modeling objects such as disks, processes, or other objects found in Windows systems. These computer system objects are modeled using classes such as Win32_LogicalDisk or Win32_Process; as you might expect, the Win32_LogicalDisk class models the logical disks installed on a computer, and the Win32_Process class models any processes currently running on a computer. Classes are based on the extensible schema called the Common Information Model (CIM). The CIM schema is a public standard of the Distributed Management Task Force (http://www.dmtf.org).
It's just the kind of progrmming interface allowing you to get system info. Here you can take a look at it's architecture, it might answer some of your questions.
Upvotes: 2