VMware Cloud Community
jgreenback
Enthusiast
Enthusiast
Jump to solution

How to get vCenter VM Name from vCloud VM

I'd like to leverage the canned "Copy file from vCO to Guest"  workflow on VMs running in vCloud Director.  The issue is that this workflow needs the vCenter VM Name.  Is there a way in Orchestrator to get a vCloud VM and then get the corresponding VM name in vSphere?

Any help would be greatly appreciated.

Thanks

To anyone else who finds this, you have to connect the the system organization and not a child organization in order to access the getVMVimRef() method.

Message was edited by: jgreenback

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Check this post from Christophe Decanini demonstrating how to get VC:VirtualMachine object from vCloud:VM - https://communities.vmware.com/docs/DOC-24307

Here is the scripting code; inputs are 'vm' of type vCloudVM (vCloud virtual machine) and 'vcServer' of type SdkConnection (vCenter connection):

var managedObject = new VcManagedObjectReference();

managedObject.type = "VirtualMachine";

managedObject.value = vm.getVMVimRef().moRef;

return VcPlugin.convertToVimManagedObject(vcServer , managedObject); // returns VC:VirtualMachine object

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Check this post from Christophe Decanini demonstrating how to get VC:VirtualMachine object from vCloud:VM - https://communities.vmware.com/docs/DOC-24307

Here is the scripting code; inputs are 'vm' of type vCloudVM (vCloud virtual machine) and 'vcServer' of type SdkConnection (vCenter connection):

var managedObject = new VcManagedObjectReference();

managedObject.type = "VirtualMachine";

managedObject.value = vm.getVMVimRef().moRef;

return VcPlugin.convertToVimManagedObject(vcServer , managedObject); // returns VC:VirtualMachine object

0 Kudos
jgreenback
Enthusiast
Enthusiast
Jump to solution

Thanks, that worked great!!

To anyone else who finds this, you have to connect the the system organization and not a child organization in order to access the getVMVimRef() method.

0 Kudos