Monday, September 22, 2014

Live Migrating multiple VMs [HyperV 2008]

This powershell script will let you live migrate multiple virtual machines serially.
The script will ask you to select which machines do you want to migrate and to which destination node as in the below screenshots

To run the script on Windows 2008 R2, you need to install powershell 3.0





 
 
 


Import-Module FailoverClusters

$clustername = Get-Cluster


$vms = Get-ClusterGroup  -Cluster $clustername  | Out-GridView -PassThru -Title "Select VMs to live migrate"
$destination = Get-ClusterNode | Out-GridView -Title "Select destination HyperV host" -PassThru
$count = 0

foreach ($vm in $vms){
 $count += 1
 $total = $vms.count
 write-output "[$count/$total] migrating $vm to $destination..."
 Move-ClusterVirtualMachineRole -Name $vm -Node $destination
}

write-output "All Done"

3 comments:

  1. Just wanted to recommend Cheapest Windows and Office Product Key Sale
    I have helped people " who cannot afford" computing, refurbish old systems donated by schools and www.go2keys.com has really enabled me to
    give these people good software that would normally be out of their reach ( I don't charge for my service,) just thought I would pass
    the word on

    ReplyDelete
  2. Just wanted to recommend Cheapest Windows and Office Product Key Sale
    I have helped people " who cannot afford" computing, refurbish old systems donated by schools and www.go2keys.com has really enabled me to
    give these people good software that would normally be out of their reach ( I don't charge for my service,) just thought I would pass
    the word on

    ReplyDelete