VMware Cloud Community
Najtsob
Enthusiast
Enthusiast
Jump to solution

How to migrate VM from one cluster to another cluster using PowerCLI ?

When I issue command

Move-VM -VM $vm -Destination $ResourcePool -Confirm:$false

I get following error

Move-VM : 19.7.2011 15:32:07    Move-VM        Destination is a Resource Pool owned by a Cluster, but the VM you are trying to move is not in that Cluster. Please select for destination a Host 
in that Cluster or a Resource Pool owned by a stanalone Host.   
At line:1 char:8
+ Move-VM <<<<  -VM $vm -Destination $ResourcePool -Confirm:$false
    + CategoryInfo          : InvalidArgument: (Flis:ResourcePoolImpl) [Move-VM], VimException
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_MoveVm_ResourcePoolOwnedByCluster,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

I'm trying to migrate VM from one cluster to another cluster.

I can perform this migration from vsphere but not via powercli.

Best regards

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The first move should also contain a Datastore parameter.

Move-VM -VM $vm -Destination $NewHost -Datastore $ds -Confirm:$false
Move-VM -VM $vm -Destination $ResourcePool -Confirm:$false

Unless your datastores are shared between the 2 clusters and you intend to keep these datastores with the new cluster.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

With the PowerCLI cmdlets this will have to be a 2-step process; first move to a host in the cluster then change the resourcepool.

With the MigrateVM_Task method this is possible in 1 step.

Let me know if you need a sample script.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Najtsob
Enthusiast
Enthusiast
Jump to solution

So something like this ?

Move-VM -VM $vm -Destination $NewHost -Confirm:$false
Move-VM -VM $vm -Destination $ResourcePool -Confirm:$false

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The first move should also contain a Datastore parameter.

Move-VM -VM $vm -Destination $NewHost -Datastore $ds -Confirm:$false
Move-VM -VM $vm -Destination $ResourcePool -Confirm:$false

Unless your datastores are shared between the 2 clusters and you intend to keep these datastores with the new cluster.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Najtsob
Enthusiast
Enthusiast
Jump to solution

Yes my datastores are shared and I'll keep them with my new cluster.

Just one more question just to be shure.

Hosts in old cluster runs on AMD processors and new cluster runs on intel's cpus. Can this couse any troubles or VM crashing ? I know I must migrate powerd off VMs, but after migration are there any special steeps to perform or I can just power n the VM and that's  it ?

Thank you very much.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

When the guests are powered off, and they are not configured with specific CPU masks, that shouldn't be a problem.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Najtsob
Enthusiast
Enthusiast
Jump to solution

It works. Thank you very much for your effort.

Reply
0 Kudos