cross vcenter vmotion

Does anyone have a workflow to vmotion a vm across vcenters with different SSO domains (supposed to be possible but only through orchestrator in v7)

6 Replies


as it happens, I'm currently working on that topic 🙂

Here's the API call for source vCenter:

var serviceLocator = new VcServiceLocator();

serviceLocator.credential = new VcServiceLocatorNamePassword();

serviceLocator.credential.username = username;

serviceLocator.credential.password = password;

serviceLocator.instanceUuid = targetVCInstanceUUID;

serviceLocator.sslThumbprint = sslThumbprint;

serviceLocator.url = url;

var relocateSpec = new VcVirtualMachineRelocateSpec();

relocateSpec.datastore = new VcManagedObjectReference();

relocateSpec.datastore.type = "Datastore";

relocateSpec.datastore.value = targetDatastoreMoId;

relocateSpec.pool = new VcManagedObjectReference();

relocateSpec.pool.type = "ResourcePool";

relocateSpec.pool.value = targetResourcePoolMoId; = new VcManagedObjectReference(); = "HostSystem"; = targetHostMoId;

var devices = vm.config.hardware.device;

var arr = [];

arr.push (new VcVirtualDeviceConfigSpec());

relocateSpec.deviceChange = arr;

relocateSpec.deviceChange[0] = new VcVirtualDeviceConfigSpec();

relocateSpec.deviceChange[0].operation = VcVirtualDeviceConfigSpecOperation.edit;

for (var i in devices) {

  if (System.getModule("").isSupportedNic(devices[i])) {

  var backing = devices[i].backing;

  backing.deviceName = targetNetworkName;

  relocateSpec.deviceChange[0].device = devices[i];

  relocateSpec.deviceChange[0].device.backing = backing;



relocateSpec.service = serviceLocator;

System.log("Start migration of VM " + vm);

relocateVmTask = vm.relocateVM_Task(relocateSpec);

Find attached a screenshot of the workflow to see the parameters (ignore participantId and participantName).

Currently this logic only supports VMs with one NIC, and standard vSwitch. For more NICs and vDS support you have to exand /change the device change parts of the script above.

Here's some example data (so you get the right format for vCenter URL and SSL thumbprint:

participantObj.targetVCInstanceUUID = "d9dd6319-7d13-48d3-9b79-cddb27f1bcbe";

participantObj.targetResourcePoolMoId = "resgroup-202";

participantObj.targetDatastoreMoId = "datastore-143";

participantObj.targetHostMoId = "host-29";

participantObj.targetNetworkName = "VM Network";

participantObj.username = "administrator@vsphere.local";

participantObj.password = "blahblah";

participantObj.sslThumbprint = "25:ce:76:57:a1:c4:3b:56:06:68:2d:7d:9c:e1:5b:1e:e0:8e:53:74";

participantObj.url = "https://vcsa-01a.acme.local/sdk";

From my link / todo list 🙂

Extracting SSL Thumbprint from initial Connect-VIServer

Cross vCenter Server vMotion requirements in VMware vSphere 6.0 (2106952) | VMware KB

make sure to specify



0 Kudos

In my case I'm migrating to a vCenter that is NOT known / registered in the vRO the workflow runs on, therefore the moids for target inventory are just plain text (the workflow gets from some additional logic upfront).

If your target vCenter is connected to the same vRO, you can of course use the vRO inventory objects directly as input, and get their managed object ids programmatically, same for vCenter UUID. Not sure about the credentials and SSL thumbprint though, that might be a bit more tricky...

0 Kudos

thanks,  if you do any more work with this let me know, also if you do vds. 

0 Kudos

Here is what I have started working with that is able to move a VM to a different vCenter with a different PSC but in the same SSO domain as well as handle moving from DVS to DVS.

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [|]
Come follow me on twitter

**The Cloud is a journey, not a project.**
0 Kudos

When I try to import your package I get a wrong key error message.  Can you post the code for your workflow?

0 Kudos

So I stumbled on this solution as I'm working on a workflow to migrate VRA managed VMs from old cluster to new cluster with NSX.

Tasks I need to complete is

  • add to new reservation.
  • update vra Extensible Attributes
  • migrate same vcenter, but new cluster with new datastore
  • update IP Address, GW, and Subnet mask

So it appears that the workflow from will do the migration. 

And I've already made workflows that update the EAs. 

But question is how to update the IP network config in the VM?

Damion Terrell  .   +  (He/Him)  +  . *  .  +   @   + .    *  .    +      .                    
Core IT Service Specialist * . + * . + . + . + * +
UNM – IT Platforms – VIS + . . . . . . . . . . + . + * . + * .
* . . + . . . . + . + * + .
“You learn the job of the person above you, * + . + * @
and you teach your job to the person below you..” . * +
0 Kudos