Querying and Viewing the WMI Repository

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

You can use Windows Management Instrumentation (WMI) to view a running application's configuration data. Table 1 lists the ways you can query WMI.

Table 1: Techniques for Querying WMI

Application language

Recommended technique

.NET Framework applications

Use classes in the System.Management namespace.

Scripts written in Microsoft ActiveX script hosting, including Visual Basic Scripting Edition (VBScript), Microsoft JScript, and Perl

Use a scripting API for WMI.

Visual Basic 6.0 applications

Use a scripting API for WMI.

Active Server Pages

Upgrade to ASP.NET and use the classes in the System.Management namespace.

C++ applications

Adapt the application to use the .NET Framework. Use C++/CLI along with the classes in the System.Management namespace, or use the COM API for WMI.

There are two utilities that are useful for working with WMI:

  • Windows Management Instrumentation Tester (WBEMTest). This is part of the Windows operating system.
  • WMI Administrative Tools. This is a collection of tools available for download in the Microsoft Download Center. It includes the WMI Object Browser, WMI Event Viewer, the WMI CIM Studio, and the****WMI Event Registration Tool.

This section discusses how to use each of these utilities to examine the WMI objects that are created by the manageable configuration source.

Using the WBEMTest Utility

The Windows Management Instrumentation Tester dialog box (WBEMTest) is a general-purpose tool that you can use to query and update any section of the WMI repository. This includes custom sections such as those for Enterprise Library.

To use the Windows Management Instrumentation Tester

  1. To view the WMI data for Enterprise Library, you must first run an application that uses an Enterprise Library App.config file.
  2. After the application is running, click Start, click Run, type wbemtest, and then click OK.
  3. In the Windows Management Instrumentation Tester dialog box, click Connect.
  4. In the Connect dialog box, type the namespace root\EnterpriseLibrary, and then click Connect.
  5. Click Enum Classes to search for a specific class to view. To view all available classes, leave the Enter superclass name text box empty, select the Recursive radio button, and then click OK.
  6. Double-click an entry in the list of top-level classes that appear in the QueryResult dialog box. This opens the Objecteditor dialog box, where you can view, edit, or delete the qualifiers, properties, and methods for the class. You can also view the Microsoft Operations Framework (MOF) description of the current object, and view individual instances.
  7. To navigate to another object in the class hierarchy, click the Derived button to open the QueryResult dialog box. This automatically shows the result of querying for derived classes.
  8. Double-click a class in the Queryresult dialog box to show the Objecteditor dialog box for that class.

To query for a specific class in the WBEMTest utility

  1. With the application running, click Start, click Run, type wbemtest, and then click OK.
  2. In the main Windows Management Instrumentation Tester dialog box, click Connect.
  3. In the Connect dialog box, type the namespace root\EnterpriseLibrary, and then click Connect.
  4. In the main Windows Management Instrumentation Tester dialog box, click Query.
  5. In the Query dialog box, enter a query to select the items you require. Here some examples:
    • To get the configuration for an application, type SELECT * FROM ConfigurationSetting WHERE ApplicationName = "myApplication", and then click Apply.
    • To get the configuration for a section of an application, type SELECT * FROM ConfigurationSetting WHERE ApplicationName = "myApplication" AND SectionName = "sectionName", and then click Apply.
    • To get connection strings for an application, type SELECT * FROM ConnectionStringSetting WHERE ApplicationName = "myApplication", and then click Apply.
  6. In the Query Result dialog box, double-click an instance to open it in the Object Editor.

Note

By default, the WMI/Group Policy provider applies Group Policy settings when it retrieves the configuration information.

Using the WMI CIM Studio

The WMI Administrative Tools provide a comprehensive set of tools for monitoring, querying, and working with data exposed by WMI. You can use the WMI CIM Studio tool to view and edit the data exposed by WMI.

To view WMI information using WMI CIM Studio

  1. To view the WMI data for Enterprise Library, you must first run any application that uses an Enterprise Library App.config file.
  2. After you start the application, start WMI CIM Studio from the WMI Tools section of the Start menu. You may have to right-click in the Information Bar in Internet Explorer and then click Allow BlockedContent to allow the ActiveX controls it uses to install and run.
  3. In the Connect to namespace: dialog box, type root\EnterpriseLibrary to connect to the Enterprise Library configuration information, and then click OK.
  4. In the WMI CIM Studio Login dialog box that opens next, you can specify logon details for WMI, including impersonation and authentication level. Leave all these settings at their default values, and then click OK.
  5. WMI CIM Studio reads the data from the WMI repository and displays a tree view in the left window. You can select a class here, and the right window displays the properties, methods, and associations for this class.
  6. Select a class for which there are concrete instances available, and then click the Instances button in the toolbar above the list of properties on the right. This shows the list of available instances in the right window. Select one by double-clicking it. The right window displays the properties, methods, and associations of the selected instance. Note that the settings in Group Policy override the settings in the .config file.

Additional WMI Resources

For information about managing applications using WMI, see Managing Applications Using WMI.

For details about using scripts and other techniques for accessing WMI, see Creating a WMI Application or Script. WMI can also be accessed using Windows PowerShell. For more details, see Accessing WMI From Windows PowerShell.

The WMI Diagnosis Utility (WMIDiag.vbs) is a VBScript script that helps you ascertain the current state of the WMI service on a computer. The download package includes the utility itself, a ReadMe file that provides more details about the tool, and explains how to use it, along with sample spreadsheets that provide information about the default WMI configuration on different versions of the Microsoft Windows operating system. You can download the WMI Diagnosis Utility from the Microsoft Download Center.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.