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.name = "memoryCount" $vcoVariable.type = "number" $vcoVariable.value = "8" $vcoVariable += New-Object -TypeName VCO.WorkflowTokenAttribute $vcoVariable.name = "cpuCount" $vcoVariable.type = "number" $vcoVariable.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.