I'll have to assume a few things here so my answer makes sense
1. You're using the vRA Service Portal
2. You want to build a custom form
3. You want the custom form to have a drop-down with a list of VMs owned by the current user
4. You are using a PowerShell script to list the VMs
5. You want the VM names output by the script to be displayed in the drop-down using ExternalValues
OK so far?
I've done stuff like the above before and it can be a bit messy and slow. It IS DEFINITELY possible though.
To get the drop-down values you would need to write an action which calls your PowerShell script and returns the VM list as an Array of strings. Note that the script invocation can be quite slow as the E2E conversation is from vRA --> vRO --> PowerShell Remote --> PowerShell script --> VC and then all the way back again.
Your script or the action would need to format the VM list in a way that can be easily tokenized by vRO (either CSV or perhaps JSON?) and then vRO needs to process that result into an Array of string values to return.
Once you have all of that sorted out you would need to be aware that the script will be run EVERY TIME the form is loaded which may or may not be desirable (how many users will be able to access the form at the same time?)
As a last note, if you're using vRA and all the user VMs are managed by it, you don't need PowerShell at all - vRA keeps an inventory of the VMs and each has details of the current owner in it's attributes. Perhaps consider going that way instead of using PowerShell to do this?
All your assumptions are correct.
Let me just make it clearer im not talking about VC but VCD (vCloud Director)
I want to grab all user vApps and list them in a vRA parameter values.
The workflow is destined to run by approx ~15 people a day, is there any better way to accomplish these (better run time) ?
Why not access the vCD REST API then? I'd imagine the PS approach is most likely just a shim to query that anyway. Or use the vCD plugin in vRO to get them?
You can browse the Plugin class docs here - vRO API Explorer by Dr Ruurd and Flores of ITQ
Also, is VCD a provisioning endpoint for vRA? If so then I'd have expected the VMs/vAPPs available on it listed in the Inventory anyway?
You have some good points... I will definitely check them
I have installed the plugin and added my vcd host to vro.
I cant seem to find a way to get all user vapps names from certain organization with the plugin
I have powershell script who is doing what I have mentioned, but how do I integrate both plugin & the powershell script
$userVapps = Get-CIVApp -Org $vcdOrg -Owner $USER
I wonder if you have a permissions problem there? The user vRO is connecting to vCD as - do they have permission to see all vApps in the vCD portal?
No, no permissions problem.
My permission is system administrator.
And my user role has everything on true.
Even with API Rest there is no option of getting all vapps owned by specific owner.
I will check it!
Thanks a lot!