Cloud & Datacenter Solutions (Formerly the Private Cloud Architecture Blog)
Hello Readers/Viewers!
It is time for another Tip/Trick – and this time we will take a look at the Orchestrator Run .Net Script Activity + PowerShell + Published Data Arrays…
You may have noticed a change in behavior for the Run .Net Script Activity in the release of System Center 2012 – Orchestrator. Specifically, how it handles array or object data. Regardless how it used to act, the current behavior requires a little bit more effort to see similar results. This post will walk you through two Published Data options for handling PowerShell arrays within the Run .Net Script Activity. As a bonus, these two examples will be illustrated in two different levels of complexity.
The results of this example will look very similar to the “Flatten” functionality, but instead of using “Flatten” the delimitation is handled from within the PowerShell.
Run .Net Script Configuration – Details Tab
NOTE: Explicitly calling the $DelimProcessList at the end of the script from within the Run .Net Script Activity is optional.
Run .Net Script Configuration – Published Data Tab
Run .Net Script Results – Delimited List (Single-Value Published Data)
Example PowerShell (for copy/paste)
The results of this example will generate Multi-Value Published Data. This means that all subsequent (downstream) Runbook Activities will consume each piece of data individually. If this is not the desired output, you can use the example above or leverage the built in “Flatten” functionality for this example’s Activity.
NOTE: Explicitly calling the $ArrayProcessList at the end of the script from within the Run .Net Script Activity is optional.
Run .Net Script Results – Array List (Multi-Value Published Data)
Here we go again, same concept for Delimited Published Data (much like “Flatten”), just a bit more complexity on the PowerShell side.
NOTE: Explicitly calling the $Variables at the end of the script from within the Run .Net Script Activity is optional.
Run .Net Script Results – Delimited List (Single-Value Published Data for each Variable)
You know the drill, here is the same concept, just leveraging a bit more of an advanced example. Again, if Multi-Value Data is not what you are looking for, you can either use the example directly above or leverage the built in “Flatten” functionality for this example’s Activity.
Run .Net Script Results – Array List (Multi-Value Published Data for each Variable)
Well, besides the output, there are only a two main differences:
Which one should you use? Well, that all depends on how you want to use the output – either one piece of Published Data at a time from an Array List, or all at once in a Delimited List. The choice is yours!
NOTE: These differences span both “Simple” and “Advanced” Examples.
Delimited List Example:
Array List Example:
For more information and tips/tricks for Orchestrator, be sure to watch for blog posts in the Automation Track!
enJOY!