Sending Multiple Variables to a VCO Workflow

I don’t consider myself to be a great scripter but I’m really good at searching Google and piecing together what I need.  Lately I’ve been working on a vCenter Orchestrator workflow that called via a PowerShell script within another application. This is pretty easy to do for static workflows but gets more complicated when needing to pass variables. I found a great example here for passing a single variable but couldn’t get multiple variables to be passed and was unable to find a working solution.

After some test, trial-and-error, and then thinking about it a few minutes I realized I wasn’t initializing each new row of the array with the “New-Object -TypeName VCO.WorkflowTokenAttribute” line for each variable and thought I’d put this out there for anyone else who may be trying to figure this out.

</pre>
$vcoVariable += New-Object -TypeName VCO.WorkflowTokenAttribute
$vcoVariable[0].name = "memoryCount"
$vcoVariable[0].type = "number"
$vcoVariable[0].value = "8"

$vcoVariable += New-Object -TypeName VCO.WorkflowTokenAttribute
$vcoVariable[1].name = "cpuCount"
$vcoVariable[1].type = "number"
$vcoVariable[1].value = "2"
<pre>

I’ve now used this in multiple PowerShell scripts to pass variables to VCO workflows. The primary roll of the vCO workflows call Blueprints within vRealize Automation.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

Website Powered by WordPress.com.

Up ↑