Workflows: 5 CDXML modules

Last time we saw that you’re not really using cmdlets in PowerShell workflows – you’re using workflow activities. Some cmdlets haven’t been packaged into activities and for those you need to put them in an Inlinescript block.  You can also use an Inlinescript block to run any arbitrary piece of PowerShell.

One thing I hadn’t tried was using some of the CDXML (WMI class wrapped in XML and published as a PowerShell module) modules that ship in Windows 8 and later. As far as I was aware they hadn’t been packaged as activities –

so thought I’d try this

workflow net1 {
parallel {


Surprisingly it worked.

The only reason I can think of that it works is that the way CDXML publishes the cmdlets as functions –  ls function:\Get-NetAdapter | fl *

Enables a workflow to use the function. Even if the module containing the cmdlet hasn’t been explicitly or implicitly loaded the workflow still runs.

You can tell these cmdlets haven’t been packaged as activities as the activity common parameters aren’t available on them.

One of life’s little mysteries. I’ll get to the bottom of it and find out why eventually. In the meantime our workflows just became a whole lot richer in terms of functionality.

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

One Response to Workflows: 5 CDXML modules

  1. Hey Richard,

    Functions and other commands that don’t explicitly have their own workflow activities are implicitly wrapped in the inline script activity (which is basically invoke-command). There is also an API to generate activity wrappers for arbitrary commands. I don’t remember it off hand, but Bruce Payette talked about it in his talk at the PowerShell Deep Dive in San Diego (2011?).

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s