The real solution to creating objects in a managed WMI provider

This is a case of RTFM. The real solution to the problem of creating an object via WMI is the ManagementCreate attribute. This attribute decorates a static method that takes key parameters (themselves decorated with ManagementName) and returns a new management entity.

The mental block that I was running into was the proxy. I was equating a .NET object with a WMI object. I assumed that creation of a .NET object via "new" was equivalent to the creation of a WMI entity via "path ... create". Not the case.

The .NET objects are proxies for the WMI entities. The are created and destroyed with each request. A call to the create method should cause the enumerate method to include the new entity, as well as return the new proxy object. However, the .NET object returned from the create method will be different from the one returned from the create method. These are merely proxies to the same entity.

Problem solved. Moving on.

Leave a Reply

You must be logged in to post a comment.