CDXML: Cim jobs

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′?>
<PowerShellMetadata xmlns=’′>
  <Class ClassName=’ROOT\cimv2\Cim_DataFile’>

      <GetCmdletParameters DefaultCmdletParameterSet=’DefaultSet’>

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

Get-DataFile –AsJob

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.

This entry was posted in CDXML, CIM, PowerShell V3, PowerShell v4. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s