I use subscriptions to run Powershell code to install applications, AD work post build. I have found ABX has some issues/limits with Powershell.
I have a Workflow that has several Actions that run Powershell scripts.
One of the custom properties in the subscription is vcUuid which I pass into a workflow which returns the "targetvcenterConnection" (See below), once I have the targetVcenterConnection I use that in my vRO Actions to connect to vCenter using normal PowerCLI.
$vcfqdn = $inputs.targetVcenterConnection;
Connect-VIServer $vcfqdn -User $vcUser -Password $vcPass -Force;
$vmname = "VMNAME";
$vm = Get-vm -name $vmname;
$script = "yourscript";
$runscript = Invoke-VMScript -VM $vm -ScriptText $script -GuestUser $vcUser -GuestPassword $vcPass -ToolsWaitSecs 300;
You can then check the Exit code
if($runscript.ExitCode -eq 0)
{
$result = 'Complete'
}
else
{
$result = 'Falied'
}
###### Get vCenter connection by UUID Workflow ####
### input:string targetVcenterUuid | output:string: targetVcenterConnection ########
##############################################################
var connections = VcPlugin.allSdkConnections;
for (i=0; i<connections.length;i++) {
if (connections[i].about.instanceUuid == targetVcenterUuid) {
targetVcenterConnection = connections[i].id;
}
}
Hope this helps.