You can migrate a
virtual machine from one
vCenter Server
system to another by using Cross vCenter Server vMotion.
You can move virtual machines
between
vCenter Server
systems of vSphere version 6.0 and later by using the
Move-VM cmdlet. When
you move a virtual machine from one
vCenter Server
system to another, only datastores are supported as storage destinations.
Procedure
-
Connect to the
myVC1 source
vCenter Server
system.
Connect-VIServer 'myVC1' -Username MyUser1 -Password MyPass1
-
Connect to the
myVC2 destination
vCenter Server
system.
Connect-VIServer 'myVC2' -Username MyUser2 -Password MyPass2
-
Store the
MyVM
virtual machine, its network adapters, the destination host, port group, and
datastore in variables.
$vm = Get-VM 'myVM' -Location 'myVMhostOnVC1'
$destination = Get-VMHost 'MyVMhostOnVc2'
$networkAdapter = Get-NetworkAdapter -VM $vm
$destinationPortGroup = Get-VDPortgroup -VDSwitch 'myVDSwitchOnVC2' -Name 'myPortGroup'
$destinationDatastore = Get-Datastore 'MyDatastoreOnVc2'
-
Migrate the virtual
machine to the specified destination host and datastore and attach the virtual
machine network adapters to the destination port group.
Move-VM -VM $vm -Destination $destination -NetworkAdapter $networkAdapter -PortGroup $destinationPortGroup -Datastore $destinationDatastore