Discussion:
MSDN Question: "How To: Provide Management Data"
(too old to reply)
Peter
2006-09-07 13:46:02 UTC
Permalink
Good morning,

An MSDN article contains a simple WMI provider example. If I compile and
execute the code, the proper class is created within WMI, however, the
example fails to set the class properties. For example, `Number` should be
set to 888.

Any insight as to why this is happening would be greatly appreciated.

REFERENCE
How To: Provide Management Data
http://msdn2.microsoft.com/en-us/library/ms257343.aspx

SPECIFICS
* WMIDiag.vbs result: WMI repository state = CONSISTENT
* My user belongs to the `administrators` group
* My user has been granted full permissions to the wbem folder
* My user has been granted full permission via the `WMI Control` snap-in
* I can update the `InstanceClass` (from example) via wbemtest.exe
* Executing Instrumentation.Publish(instClass) (from example) creates an
instance in the WMI, but does not assign any values it's properties. The
properties values are always null.
Peter
2006-09-07 17:50:02 UTC
Permalink
SOLUTION

WMI classes created through managed providers are dynamic, meaning that,
when your application domain gets destroyed and your assembly unloaded, any
class instance you published gets revoked automatically. You can revoke any
class instance you published by calling Instrumentation.Revoke() and passing
along the same class instance (or for classes inherited from the Instance
class you set the Published property to false).

An In-Depth Look at WMI and Instrumentation, Part I
http://www.csharphelp.com/archives3/archive584.html

Loading...