I’ve just finished some work on a service I’m developing, and one of the features I’ve added was to publish state information via WMI, viewable from an ASP page. I’m impressed!!! just a handful of lines of code and bang! there yer go, job done.
I kept my state in a public class, with private attributes, accessible via an interface with public read-only properties, and those properties I didn’t want exposed via WMI, I marked “ignore”, the only constraint being that your properties must be serializeable, added this attribute to the class: –
Added this to the assembly info: –
Added an installer (which registers the WMI schema), you can use the DefaultManagementProjectInstaller or add a System.Management.Instrumentation.ManagementInstaller to your other installers, and run installutil. Fire up your app and away you go.
Sadly it’s not all good, as in .NET 1.1 you can’t support writeable properties in your instance classes (you can expose them but WMI clients can’t set them), nor support methods, I haven’t looked yet but perhaps that will come in .NET 2