Retrieve and relate VM information from vCD and multiple vCenters

Retrieve and relate VM information from vCD and multiple vCenters

In this article, we can see an overview of how to uniquely identify a virtual machine in both a vSphere vCenter (VC) and vCloud Director (vCD) environment.

The script will help relate the virtual machine information between vCD and VC environments.  For this to work correctly you will need to connect to the vCD server and then each VC listed in the resources section as shown below:

Connect-VIServer -Server ("eastcoast-vcenter", "westcoast-vcenter") -User Administrator -Password "Pa$$w0rd"
Connect-CIServer -Server MyvCDInstance -User Administrator -Password "Pa$$w0rd"

Foreach ($VM in Get-CIVM) {
    $VM | Select Name,`
    @{N="VM MoRef";E={$VM.ExtensionData.VCloudExtension[0].Any[0].VmVimObjectRef.MoRef}}, `
    @{N="VM InstanceUUID";E={((Get-View "VirtualMachine-$($VM.ExtensionData.VCloudExtension[0].Any[0].VmVimObjectRef.MoRef)") | Where {$_.Name -match (($VM.Id).trim("urn:vcloud:vm:")) }).Config.InstanceUuid}}, `
    @{N="vCenter Name";E={$VM.Extensiondata.vCloudExtension[0].Any[0]}}, `
    @{N="vCenter InstanceUUID";E={((Get-CIView -Id $VM.Extensiondata.vCloudExtension[0].Any[0].VmVimObjectRef.VimServerRef.href).Uuid)}}

The output will be similar to the below:

Name                 : MyVM1
VM MoRef             : vm-14
VM InstanceUUID      : 501b8bde-95da-472a-4d2d-9d97ea394bbc
vCenter Name         : westcoast-vcenter
vCenter InstanceUUID : 9B6C7A60-C60F-4C1D-A607-0A0CFA2C2D5A

Name                 : MyVM2
VM MoRef             : vm-14
VM InstanceUUID      : 502fb1ca-e9b8-82ae-3f9f-4a3ba85f081d
vCenter Name         : eastcoast-vcenter
vCenter InstanceUUID : 63D30391-44E2-447E-A709-9DD1241C3DCC


Hi Alan,

I'm a tad confused with the "vCenter InstanceUUID" output, Is this suppose to be the "vCenterId" vCloud (5.1) uses to identify the correct vCenter??  If yes then then i'm getting the incorrect UUID from this script. vCloud reports that the vCenterId is the "href" id not the UUID used in this script.

Using powerGUI I see the VimServerRef.href =, this script produces "vCenter InstanceUUID : F7CABC8B-F1EF-424C-B022-72D66D612636" as the vCenter ID. in the vCloud logs vCloud identifies the vCenter ID as "54F51AB8A60D4FE898B040325A925684" which is "href".

I need to verify this because we are getting errors from vCloud when we deploy VM's or Vapps saying that it can't find a VM moref with vCenterID that = "54f51ab8-a60d-4fe8-98b0-40325a925684". Yet we do find the correct MOREF on that vCenter. Note we only connect to the one vCenter server.



Version history
Revision #:
1 of 1
Last update:
‎02-22-2012 02:43 AM
Updated by: