First published on TECHNET on May 03, 2012
Using the Orchestrator Integration Toolkit’s Command-Line Activity Wizard, you can create your own custom activities really easily just by using a simple command line or one-line PowerShell script.
When creating activities, you can specify parameters that appear on the activity’s properties tab. When using PowerShell as the “mode” of the activity, the wizard lets you select a “usage mode” for the parameter as either “Command Argument” or “Environment Variable”. Unfortunately, there’s a bug in the code behind that wizard where the environment variable parameters are not being set in the environment. However, there’s a simple workaround – PowerShell itself!
When you would have used “Environment Variable”, just use “Command Argument” instead, and then in the front of your PowerShell command line, set the environment variable like this:
Here’s the command I used:
$env:MyEnvVar = "$(MyEnvVar)"; $output = $env:MyEnvVar; $output
This sets the environment variable “MyEnvVar” to the value supplied by the user in the activity. The $output part is simply a test to show that the environment variable is being set, and I output the variable to published data so I can see the result.
So, a simple workaround to an issue that might have bugged a few people…
Updated Mar 11, 2019
Version 4.0System-Center-Team
Microsoft
Joined February 15, 2019
System Center Blog
Follow this blog board to get notified when there's new activity