In that case, you could just register the VMs in the new cluster with New-VM and specify the correct ResourcePool on that cmdlet.
Don't forget to unregister the VMs first (with Remove-VM but don't delete the VM)
Original Message:
Sent: Oct 18, 2024 07:17 AM
From: mdrzik
Subject: Move VMs to resource pools on another cluster
Datastores will be same, shared accross datacenter, so will not used storage vmotion .
Original Message:
Sent: Oct 18, 2024 06:37 AM
From: LucD
Subject: Move VMs to resource pools on another cluster
I'm afraid not since you are moving the VMs to another Cluster, which has different ESXi nodes and Datastores.
You will have to include the include the Cluster/ESXi node and Datastore as well on the Move-VM
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Oct 18, 2024 06:33 AM
From: mdrzik
Subject: Move VMs to resource pools on another cluster
My idea was something like code bellow. Will this work ?
$sourceCluster = Get-Cluster -Name "Cluster1"$destinationCluster = Get-Cluster -Name "DestinationCluster"# Get all resource pools in the source cluster$sourceResourcePools = Get-ResourcePool -Location $sourceClusterforeach ($sourceResourcePool in $sourceResourcePools) { # Get the corresponding resource pool in the destination cluster $destinationResourcePool = Get-ResourcePool -Location $destinationCluster | Where-Object { $_.Name -eq $sourceResourcePool.Name } if ($destinationResourcePool) { # Get all powered-on VMs in the source resource pool $vms = Get-VM -ResourcePool $sourceResourcePool | Where-Object { $_.PowerState -eq "PoweredOn" } # Move each powered-on VM to the corresponding resource pool in the destination cluster foreach ($vm in $vms) { Move-VM -VM $vm -Destination $destinationResourcePool } } else { Write-Host "Resource pool '$($sourceResourcePool.Name)' not found in the destination cluster." }}
Original Message:
Sent: Oct 18, 2024 06:16 AM
From: LucD
Subject: Move VMs to resource pools on another cluster
That is for a complete vCenter to vCenter migration.
Since that script is migrating the Datastores there is no vMotion/svMotion required, only a registration of the VMs in the new vCenter.
That is completely different from what you described in your original question.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Oct 18, 2024 06:05 AM
From: mdrzik
Subject: Move VMs to resource pools on another cluster
I need something like this: https://www.linkedin.com/pulse/migrate-your-vcenter-powercli-jesse-buschhaus/ but only for resource pools. Folders and vcenter will not change.
Original Message:
Sent: Oct 18, 2024 05:57 AM
From: LucD
Subject: Move VMs to resource pools on another cluster
Since you are moving to another cluster there is vMotion and svMotion involved, that needs to be done with Move-VM afaik.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Oct 18, 2024 05:44 AM
From: mdrzik
Subject: Move VMs to resource pools on another cluster
Is not possible make more automate ? There are about 80 resource pools and hundreds of VMs.
Use Move-Inventory is not suitable for this ?
Original Message:
Sent: Oct 18, 2024 05:37 AM
From: LucD
Subject: Move VMs to resource pools on another cluster
You can use the Move-VM cmdlet.
Note that the latest PowerCLI version produces an error ("A specified parameter was not correct: RelocateSpec"), but the move is executed.
Get-VM -Name MyVM | Move-VM -Destination (Get-CLuster -Name tgtCluster | Get-ResourcePool -Name tgtRP)
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Oct 18, 2024 03:21 AM
From: mdrzik
Subject: Move VMs to resource pools on another cluster
We are going to cancel the cluster with resource pools and we need to move all VMs (some of them are on, some off) to another cluster with same structure of resource pools (RP). Storages on both clusters are same.
Is possible to do this with powershell ?
Example:
Cluster1
Team1 (RP)
VM5
name1 (RP)
VM1 (on)
VM2 (off)
name2 (RP)
VM3 (on)
VM4 (off)
we need move to:
Cluster2
Team1 (RP)
name1 (RP)
name2 (RP)