VMware Aria Automation Orchestrator

 View Only

 Orchestrator action in PowerShell. Adding "Connect-Viserver" causes the return value to be blank.

Michael Cornn's profile image
Michael Cornn posted Jun 30, 2025 02:02 PM

We're running Aria Automation 8.18.2. We write some custom actions in PowerShell. If the command "connect-viserver" is run in the action, the return value is always null. An example:

function Handler($context, $inputs) {

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null 2> $null
    #Connect-VIserver myvcenter -username $inputs.username -password $inputs.password -ErrorAction Stop
    $return = "Hello World"
    return $return
}

When we run this action, the "Action Result" is a string with value "Hello World".  Note the second line, starting with "Connect-viserver", is commented out. 

If we remove the comment on the second line of the function, it runs properly. But the "Action Result" is blank.

function Handler($context, $inputs) {

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null 2> $null
    Connect-VIserver myvcenter -username $inputs.username -password $inputs.password -ErrorAction Stop
    $return = "Hello World"
    return $return
}
Why would that command, connect-viserver, cause the return value to be blank? 
WhiteForEver's profile image
WhiteForEver

The "problem" is in using `Set-PowerCLIConfiguration`. 

If you're using it, it is returning an Array of properties. To see that, set the return type to `Any`. The Action Result will be `Array[2]`.

If you'll set the return type to Array/Properties, you will see a lot of information from the vCenter object. But not the actual return value you're expecting to get = "Hello World".

It is possible to see the value of the returned object you want to see. Set the return value of the Action Element to "Any". Create a workflow and use this Action Element in the Scriptable Task. Because it's returning an Array, you can specify [1] and see the result.

The PowerCLI is changing the return type based on the cmdlets/modules you're using. It’s not so consistent and hard to guess sometimes, but this is how it works :) 

Brandon Saxe's profile image
Broadcom Employee Brandon Saxe

Try piping the Connect-VIserver command to Out-Null. Not sure exactly why this works, but it has always fixed the issue for me.

Connect-VIserver myvcenter -username $inputs.username -password $inputs.password -ErrorAction Stop | Out-Null

Michael Cornn's profile image
Michael Cornn

Thanks for the two very helpful answers. When I piped connect-viserver to out-null, I then got the return value I needed.