Professional Documents
Culture Documents
Table of contents
• Introduction
• What is Platform Management?
• What is WMI?
• What is WMI Provider?
• Developing WMI Provider – Where to start?
• Defining Namespace
• Sample project
• How to use the Demo project
• Known problems in .NET WMI implementation
• Conclusion
• Appendix A: Definitions & Acronyms
• Appendix B :WMI tools
• Appendix C: Important Reading
• Appendix D : Developing steps to support SNMP
Introduction
This article's purpose is to describe how to develop a WMI provider in the .NET
framework. There are several incentives for writing this article:
This article does not include the use of SNMP and does not answer to the
following questions:
Nevertheless, anyone who interest in those questions can find some useful notes
regarding the required steps to expose managed application to SNMP (see
appendix D).
In a nut shell, Platform Management is the means to manage and monitor the
health of a system. This may fall into the following categories :
What is WMI?
WMI core is already a part of windows ME/2000 and XP. The WMI enables the
management capabilities by supplying the standard storage component (CIM),
the means to set and get information to and from the storage and the ability to
dock third party providers (same as plug-in) to the Providers Manager (CIMOM).
This industry standard compliancy allows alien components to share management
environment locally and remotely by using SNMP.
In order to expose software component such as a service through the WMI one
need to write WMI provider. This plug-in (provider) exposes the service to the
WMI and provides the interface to receive information and to interact with the
service. Till recently WMI Providers was written as a COM component and now
with the emerging of .NET framework it is easier to develop providers.
In case you aren’t familiar with the MOF syntax you can simply start with
developing the WMI Provider(see the sample section). When it all done and
finished use the InstallUtil.exe (see appendix B) tool to enter the managed class
into the CIM schema, then if you want you can generate the MOF file from the
WMI CIM Studio (it is highly recommended since it is the best way to learn this
syntax). If you do know how to write MOF file (lucky guy) then use the
Mgmtclassgen utility (see appendix B) to create the C# classes and events for the
WMI provider.
Defining Namespace
Namespace enables you to logically gather related managed objects under one
logic umbrella. It is recommended to define your own namespace for several
reasons:
• Order
• Efficiency – Namespace like 'CIMV2' and 'Default' contains a lot of
Managed objects. By defining unique namespace enables you to save time
while looking for your objects.
Sample project
Note: The provider instance is valid only when the service is started.
Adding an instance installer in case we want to publish the provider directly via
the InstallUtil tool. In this example we publish the provider through the service.
Defining events by using the InstrumentationType.Event attribute:
[InstrumentationClass( InstrumentationType.Event )]. Defining WMI
Provider instance using the InstrumentationType.Instance attribute:
[InstrumentationClass( InstrumentationType.Instance )]
Note: The provider code can be just as well written in the service.
1. Register the Parachute service to the SCM (Service Control Manager) with
the InstallUtil tool (%systemroot%%\Microsoft.NET\Framework\
<framework version> \InstallUtil.exe).
10. Subscribe for events: ‘Add Event Query ‘to the ‘Management Events’ item.
Conclusion
Well, that's it folks. Hopefully, this article will stimulate you to drill down into the
WMI technology and to make advantage of it. Please send feedback, bug reports
or suggestions here.
Books
Articles