Windows Management Instrumentation

Windows Management Instrumentation (WMI) serves as a framework for Windows administration, whether locally or remotely. The interface is available by various methods, including server-side scripting languages such as ASP.NET. WMI's object model allows you to query and configure nearly all aspects of the Windows operating system.

The WMI model provides for several uses, whether complete remote administration or simple manipulation. Information and data requests can be handled in the WMI component model, which effectively handles the details of the implementation to WMI.

WMI is based on the Common Information Model (CIM). The CIM is a standard of the DMTF organization (go to dmtf.org for more data about this acronym). The CIM is specified at http://www.dmtf.org/standards/standard. CIM is an object-oriented model that sorts and describes information in a given environment. CIM objects can be physical resources such as hardware, logical resources such as software, or networks. Figure 24.1 shows the CIM core model.

Figure 24.1. The CIM Core Object Model

graphics/24fig01.gif

This model makes up the basic CIM Schema. The CIM Schema includes many base classes. Each platform includes its own implementation of these classes.

WMI is the Microsoft implementation of the CIM model, and it adheres to the Web-Based Enterprise System Management (WBEM) standard (for more information, go to http://www.dmtf.org/standards/standard_wbem.php). Using WMI, developers can manage Windows effectively, with standard methods.

WMI is an integral part of Windows 2000/XP. It is available as a stand-alone application for Windows 95, 98, and NT 4. WMI has two main components: the WMI main component (winmgmt.exe) and the CIM repository. The CIM repository serves as a database of available static data.

Application data requests are passed through winmgmt.exe. Winmgmt.exe supports COM interfaces for interaction. Developers are rarely aware that this application even exists they just know of the functionality if it happens to surface. If the request is for static information, the information is gathered from the CIM repository and passed to the requesting application. If the request is for dynamic data, the appropriate provider is polled and the results are returned to the application.

WMI uses multiple types of providers to meet these needs, as shown in Table 24.1.

The .NET framework provides a number of base class libraries that help instrument .NET applications. These libraries reside in the System. Management.Instrumentation, the System.Diagnostics, and the System. Management namespaces. Actually, WMI doesn't reside in System. Diagnostics, the OerCounters reside in this namespace. Between these three namespaces, you will find all the base class libraries that give WMI and Performance Monitor support.

Visual Studio .NET cannot automatically find the System.Management namespace. To use the System.Management namespace, you need to add a reference to your project. To do this, right-click the project name in the Solution Explorer, select Add Reference, scroll down in the .NET list, select System.Management, and then click the OK button. From this point on, you can use the System.Management namespace in your projects. Figure 24.2 shows how to add this reference to your project.

Figure 24.2. You'll Need to Add the System.Management Namespace.

graphics/24fig02.jpg

Table 24.1. The CIM Classes

Class

Description

Performance Monitor Provider

Provides access to Windows NT Performance Monitor data.

Registry Provider

Provides access to system registry data.

Registry Event Provider

Sends events when changes occur to registry keys, values, or trees.

SNMP Provider

Provides access to events and data from SNMP devices such as routers, hubs, and switches.

Windows NT Event Log Provider

Provides access to data and event notifications from the Windows NT Event Log.

Win32 Provider

Provides access to data from the Win32 subsystem.

WDM Provider

Provides access to data and events from device drivers that conform to the Windows Driver Model WMI extensions.



ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
EAN: N/A
Year: 2003
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net