updated: Calling vCO-Workflows from Powershell

It was long on the TODO-list, now I got an reason (http://communities.vmware.com/thread/316038?tstart=0):
Extending the Powershell-script that calls vCO-workflows with input and output-parameters.

When executing the workflow, you have to specify an array of WorkflowtokenAttribute-Objects, which can be created in the namespace of the Webservice-Proxy:


# Connect to vCO and generate Proxy $vcoWS (-Class and -Namespace for easy stub-object generation later
 $vcoWS = New-WebServiceProxy -Class VCO -Namespace VCO -Uri http://192.168.215.176:8280/vmware-vmo-webcontrol/webservice?WSDL
 ...

# generate Array with Input PArameters (WorkflowTokenAttribute - Objects)
 $inparams = @()

# fill the array, one entry for each input parameter
 $inparams += New-Object -TypeName VCO.WorkflowTokenAttribute
 $inparams[0].name = "inputString"
 $inparams[0].type = "String"
 $inparams[0].value = "Hello World"

# ... and exectue (use $null instead on $inparams if Workflow has no input parameters
 $workflowToken = $vcoWS.executeWorkflow($workflow.id, "vcoadmin1" , "VMware2010", $inparams)

...

A comparable array of WorkflowTokenAttribute-Objects which contains the Output-Parameters of the workflow can be returned by


# get Output-Parameter, when workflow has finished #($wftResults is again an array of WorkflowTokenAttribute
$wftResults = $vcoWS.getWorkflowTokenResult($workflowToken.id, "vcoadmin1", "VMware2010")
$wftResults

the missing link: How to create Stub-Objects from scratch…
the hint: http://stackoverflow.com/questions/4196523/render-ssrs-report-with-parameters-using-soap-in-powershell

See the full updated example here:
http://www.vcoportal.de/examples/powershell-vco/