One of the freebies you get when using CDXML is that the cmdlets you create automatically get the –AsJob parameter. I was thinking about jobs in general and realised that I didn’t know how CIM jobs were run.
To put this into context:
PowerShell jobs run in another PowerShell process that is started as a child of the PowerShell process in which you start the job.
WMI jobs use a process called unsecapp – C:\Windows\System32\wbem\unsecapp
Another process – C:\Windows\system32\wbem\wmiprvse.exe will also run.
In order to discover the process(es) used by CIM jobs I needed a CIM job that would run for a long time – using CIM_DataFile class to enumerate the files on disk would work. I created a quick module using that class
<?xml version=’1.0′ encoding=’utf-8’?>
and saved it as Cim_DataFile.cdxml
After importing the module I opened another PowerShell session and got a list of processes as a baseline.
Then use the new cmdlet in a Job
The job type is CimJob
A new process appears – wmiprvse. This the same process that appears with WMI jobs. The path to the exe is C:\Windows\system32\wbem\wmiprvse.exe and the Description is: WMI Provider Host
This process provides isolation for WMI activities so that the whole of WMI isn’t pulled down in the event of a failure.
The same process is started if Get-CimInstance Cim_Datafile is run.