wmi

WMI Tutorial – I

While developing scripts (not restricted to QTP/UFT), we all sometimes need to know the version of MS Office, Operating System version etc to handle different scenarios programmatically. To know the system properties, there is a technique called WMI provided by Microsoft inbuilt in its operating system ‘Windows’. In the next few posts, I will introduce you to WMI.

Introduction:
So, what is WMI. It stands for Windows Management Instrumentation. Windows Management Instrumentation (WMI) is the primary management technology for Microsoft® Windows® operating systems.WMI conforms to industry standards overseen by the Distributed Management Task Force (DMTF). The DMTF is an industry organization that works with key technology vendors, including Microsoft, as well as affiliated standards groups to define interoperable management solutions.

History:
WMI was originally released in 1998 as an add-on component with Microsoft® Windows NT® 4.0 with Service Pack 4. WMI is now an integral part of the Windows family of operating systems, including Microsoft Windows 2000, Microsoft® Windows® XP and Windows 7.

WMI Architecture:
Within WMI Architecture, there are four components we need to consider:
WMI Flow

1) WMI Management Applications include tools such as the Exchange System Manager.  A management application can query, enumerate data, run provider methods or subscribe to events.

2) The WMI Infrastructure has two components – the WMI Service (winmgmt) including the WMI Core, and the WMI Repository.  The WMI Repository uses a namespace containing several sub-namespaces that are arranged hierarchically to organize objects.  A management application must connect to a namespace before the application can access objects within the namespace.  WMI names the namespace root directory as root.  The WMI service creates some namespaces such as root\default, root\cimv2 and root\subscription at system startup and pre-installs a default set of class definitions.  The WMI service acts as an intermediary between the providers, management applications, and the WMI repository. Only static data about objects is stored in the repository, such as the classes defined by providers.  WMI obtains most data dynamically from the Provider when a client requests it.

3) A WMI Provider is a COM object that monitors managed objects for WMI.

4) A Managed Object is a component (logical or physical) – such as a hard drive, network card, Operating System or service.  A provider supplies WMI with data from an object and handles messages from WMI to the object.  A WMI provider consists of a DLL and a Managed Object Format (MOF) file that defines the classes for the provider.  WMI classifies providers according to the interface features supplied by the provider.  WMI provider developers write their classes in the MOF language

In the next post, we will look at the different ways to connect to WMI Classes to retrieve information.

Advertisements

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s