Export (0) Print
Expand All

Technology Summary for WMI .NET 

.NET Framework 2.0

Windows Management Instrumentation (WMI) is a component of the Windows operating system that allows you to programmatically access management information in an enterprise environment. WMI in .NET Framework is built on the original WMI technology and allows the same development of applications and providers with the advantages of programming in the .NET Framework. For more information, see Benefits of WMI in .NET Framework.

The .NET Framework classes that use WMI are in the System.Management and System.Management.Instrumentation namespaces. However, managed code applications, built on .NET Framework, have a few limitations that the original WMI providers and applications do not. For more information, see Limitations of WMI in .NET Framework.

Keywords

Qualifier, provider, WMI query language, event consumer, Common Information Model, asynchronous, semisynchronous, Win32 schema, management application

Namespaces

System.Management, System.Management.Instrumentation

Related Technologies

Windows Management Instrumentation (WMI)

WMI in .NET Framework is built on the original WMI technology. For more information on the original WMI, see "About WMI" in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

Background

The unmanaged version of WMI is the Microsoft implementation of Web-Based Enterprise Management (WBEM), which is an industry initiative developed to standardize the technology for managing enterprise computing environments. WMI uses classes based on the Common Information Model (CIM) industry standard to represent systems, processes, networks, devices, and other enterprise components.

WMI supplies a pre-installed class schema that allows scripts or applications written in scripting languages, Visual Basic, or C++ to monitor and configure applications, system or network components, and hardware in an enterprise. For example, instances of the Win32_Process class represent all the processes on a computer and the Win32_LogicalDisk class can represent any disk devices. For more information, see "Win32 Classes" in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

The WMI architecture consists of the following tiers:

  • Client software components perform operations using WMI, such as reading management details, configuring systems, and subscribing to events.

  • The object manager is a broker between providers and clients that provides some key services, such as standard event publication and subscription, event filtering, query engine, and other services.

  • Provider software components capture and return live data to the client applications, process method invocations from the clients, and link the client to the infrastructure being managed.

For more background information on WMI and WMI .NET, see WMI and .NET Framework Schema. For more information on pre-supplied classes, methods, and providers, see "About WMI" in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library. For more information on the System.Management and System.Management.Instrumentation namespaces, see the .NET Framework Class Library Reference. The .NET Framework also contains general .NET Framework programming information.

Implementing WMI .NET Classes

WMI in .NET Framework is built on WMI technology and allows the same development of applications and providers with the advantages of the .NET Framework. For more information, see Benefits of WMI in .NET Framework. However, managed code applications built on the .NET Framework have a few limitations that the original WMI providers do not. For more information, see Limitations of WMI in .NET Framework.

WMI organizes its reinstalled classes into namespaces. The WMI namespaces, such as root\cimv2 and root\default, are not to be confused with the .NET Framework namespaces System.Management and System.Management.Instrumentation. The System.Management namespace contains the WMI in .NET Framework classes to carry out WMI operations. The System.Management.Instrumentation namespace contains the classes for adding instrumentation to your application.

Administrators and IT developers can use the classes in System.Management to write applications that access WMI data in any .NET language, such as ASP.NET, C#, Visual Basic .NET, or J#. These applications can:

  • Enumerate or retrieve a collection of instance property data, such as the FreeSpace property of all the instances of Win32_LogicalDisk on all the computers of a network. For more information, see "Win32_LogicalDisk" in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

  • Query for selected instance data.

    WMI in .NET Framework uses the original WMI WQL query language, a subset of SQL. For more information on WQL, see "WQL query language" in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

  • Subscribe to events, defined as instances of event classes.

    An event occurs when an instrumented application (provider) creates an instance of one of its event classes.

Developers can use the classes in System.Management.Instrumentation to instrument their application so that it provides data to WMI about the behavior of the application.

Instrumentation involves creating your own classes and instances with properties and methods that store data about your application to WMI. By setting certain attributes on classes, you can designate them as instrumentation. For example, your application may expose data about its health and performance or resource use. The application could also supply data to WMI about devices with which the application interacts. You can create classes and register those classes with WMI to make that data available to other scripts and applications. An instrumented application is a provider of data to WMI in the same way that providers work in the original WMI.

The functionality of WMI in .NET Framework is supported by a set of WMI tools built in to the Microsoft Visual Studio .NET development environment. For example, the Visual Studio .NET Server Explorer Management Extension (downloadable from http://www.microsoft.com/downloads/details.aspx?familyid=62d91a63-1253-4ea6-8599-68fb3ef77de1) can be used to aid in the development of management-aware applications.

WMI .NET Classes at a Glance

The following tables list the main classes that must be implemented for each of the specified task areas. Where relevant, the associated interfaces and configuration elements are also listed. This is not a comprehensive list of all the classes in each namespace, but it includes all classes demonstrated in the How-to topics.

System.Management Namespace

Technology Area Classes/interfaces/configuration elements

Gathering WMI class information

ManagementObject, ManagementClass

Querying for data

Querying for data asynchronously

SelectQuery, ManagementObjectSearcher, WqlObjectQuery, ObjectQuery

ManagementObjectCollection, ManagementOperationObserver

Executing methods

Executing methods asynchronously

ManagementBaseObject

ManagementOperationObserver

Receiving events

Receiving events asynchronously

WqlEventQuery, ManagementEventWatcher

EventArrivedEventArgs, EventArrivedEventHandler, CompletedEventArgs, CompletedEventHandler

Connecting to a remote computer

ConnectionOptions, ManagementScope

System.Management.Instrumentation Namespace

Technology Area Classes/interfaces/configuration elements

Creating data providers

Instance, InstrumentationClassAttribute, InstrumentedAttribute

Creating event providers

BaseEvent, Instrumentation

Registering a provider

ManagementInstaller

See Also

Other Resources

WMI .NET Overview

Community Additions

ADD
Show:
© 2014 Microsoft