I'm trying to pull and use the owner of the VM in one of my workflows and it doesn't look like vCACVirtualMachine has that property available. What's the easiest way to pull that into my workflow for future use?
You can try this... but there might be a timing issue on the Entity creation.
(I think there is a vcacvm.getEntity() method to get the actual entity. I can't check right now.)
var ownerEntity = virtualMachineEntity.getLink(vCACHost, "Owner")[0];
var ownerName = ownerEntity.getProperty("UserName");
I think I have some other methods as well. You are right to assume the requestor isn't always the owner.
You can try this... but there might be a timing issue on the Entity creation.
(I think there is a vcacvm.getEntity() method to get the actual entity. I can't check right now.)
var ownerEntity = virtualMachineEntity.getLink(vCACHost, "Owner")[0];
var ownerName = ownerEntity.getProperty("UserName");
I think I have some other methods as well. You are right to assume the requestor isn't always the owner.
Do you have the property __Legacy.Workflow.User available? I do in 6.2.1
So I use this to extract the requestor using the following pwoershell:
#passing the value of __Legacy.Workflow.User to $Requestor through string replacement
$User = (($Requestor -split "@")[0])
I ended up just setting the owner as a custom attribute during the initial provisioning. Makes it easy to grab it during the workflow stubs.