WmiConfigurationAttribute.HostingModel Property

Definition

Gets or sets the hosting model for the WMI provider.

public:
 property System::Management::Instrumentation::ManagementHostingModel HostingModel { System::Management::Instrumentation::ManagementHostingModel get(); void set(System::Management::Instrumentation::ManagementHostingModel value); };
public System.Management.Instrumentation.ManagementHostingModel HostingModel { get; set; }
member this.HostingModel : System.Management.Instrumentation.ManagementHostingModel with get, set
Public Property HostingModel As ManagementHostingModel

Property Value

A ManagementHostingModel value that indicates the hosting model of the WMI provider.

Examples

In the following example, the WmiConfigurationAttribute is used to indicate that the assembly it is contained in implements a provider that is exposed through the root\NVPair namespace. Because the hosting model is not Decoupled, it is an in-process provider. The value NetworkService indicates that the in-process provider runs under the NetworkService security context.

[assembly: WmiConfiguration("root\\NVPair", HostingModel = ManagementHostingModel.NetworkService)]  

In the next example, the WmiConfigurationAttribute is used to indicate that the assembly it is contained in implements a provider that is exposed through the root\NVPair namespace. The value Decoupled indicates that it is a decoupled provider.

[assembly: WmiConfiguration("root\\NVPair", HostingModel = ManagementHostingModel.Decoupled)]  

Remarks

WMI providers can be hosted by an application or by the WMI service. WMI providers hosted by an application are called decoupled providers. Those hosted by the WMI service are called in-process providers. The hosting model value determines both the hosting model and, in the case of in-process providers, the account (security context) under which the provider runs. For more detail about the possible values of HostingModel, see ManagementHostingModel.

To learn more about hosting models, see the Provider Hosting and Security topic in the WMI SDK on MSDN.

Applies to