Anyone have a script to move a set of VM's from cluster A to B. I need to turn off the VM's, as the old cluster is on AMD and the new cluster is on Intel.
No need to change network or storage, as this is the same on both clusters.
Any help is appreciated.
Did you try the Move-VM cmdlet with the Destination parameter pointing to the cluster B, and the Datastore parameter pointing to a datastore on cluster B?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Does Move-VM shutdown the VM if powered on, then move the server, start it up again?
No, you will have to shutdown the VM separately.
But that can be scripted.
Note that you need some logic to select the datastore in Cluster B.
$clusterA = Get-Cluster -Name A
$clusterB = Get-Cluster -Name B
foreach($vm in Get-VM -Location $clusterA){
if($vm.PowerState -eq [VMware.VimAutomation.ViCore.Types.V1.Inventory.PowerState]::PoweredOn){
Shutdown-VMGuest -VM $vm -Confirm:$false > $null
while($vm.PowerState -ne [VMware.VimAutomation.ViCore.Types.V1.Inventory.PowerState]::PoweredOff){
sleep 5
$vm = Get-VM -Name $vm.Name
}
}
Move-VM -VM $vm -Destination $clusterB -Datastore $ds -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference