Posted by: Richard Siddaway
PowerShell 3, WMI
I found a class new to me – Msft_Providers and this got me interested in WMI providers.
PS> Get-CimInstance -Class Msft_Providers | select -ExpandProperty provider
SCM Event Provider
That seems a bit low. Digging a bit more I got back to the old favourite __provider.
Get-CimInstance -Class __provider | Measure-Object
produces an answer of 43 – not quite the answer to life, the universe and everything but close.
Is there any overlap between the two groups of providers?
$providers = Get-CimInstance -Class Msft_Providers | select -ExpandProperty provider
Get-CimInstance -Class __provider | where Name -in $providers | select Name
provides the answer
SCM Event Provider
In case you were wondering – “Starting with Windows Vista, the WMIPerfClass Provider and the WMIPerfInst Provider dynamically provide performance counter data for the WMI Performance Counter Classes.”
One interesting property is the Hosting Model
Get-CimInstance -Class __provider | select HostingModel -Unique
But what do these mean
Full explanations for these and the other hosting models can be found at
WmiCore – Activate provider in host to the WMI service. This hosting model is only supported for operating system components.
WmiCoreOrSelfHost – Activate provider in host to the WMI service or as local server. This hosting model is only supported for operating system components.
SelfHost – Activate provider as a local server implementation.
Decoupled:Com – Activate provider as a decoupled COM provider. See http://msdn.microsoft.com/en-us/library/aa390882(v=vs.85).aspx
Decoupled:NonCom – Activate provider as a non-COM event provider.
LocalSystemHost – Activate provider in the provider host process that is running under the LocalSystem account.
LocalSystemHostOrSelfHost – The provider is self-hosted or loaded into the Wmiprvse.exe process running under the LocalSystem account.
NetworkServiceHost – Activate provider in the provider host process that is running under the NetworkService account.
LocalServiceHost – Activate provider in the provider host process that is running under the LocalService account.
NetworkServiceHostOrSelfHost – The provider is self-hosted or loaded into the WmiPrvse.exe process running under the NetworkService account. NetworkServiceHostOrSelfHost is the default configuration when the HostingModel property in __Win32Provider is NULL. Because NetworkServiceHostOrSelfHost is the default, providers from earlier operating systems can continue to work in Windows Vista, Windows Server 2008, and later operating systems.
Get-CIMInstance is a new cmdlet in PowerShell v3. It is part of the new API for working with WMI. I will be blogging about these in greater detail over the next weeks and months as Powershell v3 is released.
More information on providers and the CIM cmdlets can be found in PowerShell and WMI – www.manning.com/powershellandwmi