You can use WMI from client applications and scripts. It provides an infrastructure that makes it easy to both discover and perform management tasks. In addition, you can add to the set of possible management tasks by creating your own WMI providers.
The following topics are discussed in this section:
The following procedure describes how to obtain data from WMI by writing a script or application.
To obtain data from WMI by writing a script or application
- Decide which language to use. For more information about scripting, see
Creating a WMI Script.
For more information about C++, see Creating a WMI Application Using C++. For using more information about C# or WMI .NET, see WMI .NET Overview.
You can view or manipulate WMI data in many languages. The following table lists the topics that describe how to use the scripting and application languages to obtain data.
Application language Topic
Scripts written in Microsoft ActiveX script hosting, including Visual Basic Scripting Edition (VBScript) and Perl
Start with Creating a WMI Script.
WMI PowerShell Cmdlets, such as Get-WmiObject.
Visual Basic applications
Active Server Pages
Start with Creating Active Server Pages for WMI.
.NET Framework applications written in C#, Visual Basic .NET, or J#
- Ensure that your connections to remote computers work.
For more information, see Connecting to WMI on a Remote Computer.
- Connecting to WMI on remote computers requires the correct security settings, as explained in Maintaining WMI Security. The following table lists the topics that describe how to configure security settings with the scripting and application languages.
Scripts in any language, Visual Basic applications
Active Server Pages
- After connecting to WMI, you can obtain data through queries and enumerations.
- Registry data is available through WMI and you can create new keys and values or modify existing ones.
For more information, see Modifying the System Registry.
- You can subscribe to event notifications through WMI, either temporarily between system reboots or permanently.
- Performance counter data for a system is available through WMI.
The system performance library counters are converted to WMI classes. For more information, see Monitoring Performance Data.
- WMI Tasks for Scripts and Applications describes how to do many administrative tasks with WMI.
The following procedure describes how to supply data to WMI by writing a provider.
To supply data to WMI by writing a provider
- Decide on the type of provider to write.
You cannot write a WMI provider in VBScript. However, you can take several other approaches to writing a WMI COM provider:
- Using the WMI ATL Wizard in Visual Studio.
- Using COM directly in any integrated development environment.
This approach creates an unmanaged COM provider.
- Using WMI in the .NET Framework to create a managed code provider.
This approach creates a managed code provider. Managed code providers can be written in any .NET Framework language, are simpler to write than WMI COM providers, and can obtain data from the WMI CIM-based classes such as Win32 Classes. However, the .NET Framework WMI provider has some limitations. For more information, see Managing Applications Using WMI.
- Using the provider framework classes is not recommended.
The provider framework has been superseded by the WMI ATL wizards, using COM directly, or .NET Framework providers. Creating a WMI COM provider with the provider framework classes is no longer recommended. The following table lists the topics that describe how to use COM or .NET Framework providers.
COM provider in the same process as WMI
COM decoupled provider
.NET Framework provider in C# or Visual Basic.NET
The following topics provide information about using WMI to monitor and control enterprise components.
Describes how to find the correct WMI class and procedures to use in scripts and applications that perform common computer and network administration tasks, such as adding a new printer connection for a remote computer or finding all the installed hotfixes on a computer.
Any scripting language, such as VBScript or Perl, that works with ActiveX objects can access WMI data. Applications can access WMI in C++, using the COM API for WMI or in Visual Basic, using the Wbemdisp.tlbtype library and the Scripting API for WMI.
Describes how scripts, applications, and providers can establish connections to WMI on remote computers to obtain data or control hardware and software.
Describes how to use Windows PowerShell to establish connections to WMI on remote computers to obtain data or to control hardware and software.
Describes how to get event notifications by creating temporary or permanent WMI event consumers.
WMI supplies dynamic management data to client scripts and applications by obtaining it from providers.
Describes how to access nondefault providers and considerations for provider writers on 64-bit systems.