Q: How can I trigger multiple concurrent Live Migrations using Windows PowerShell?
A: It's easy to trigger multiple Live Migrations using PowerShell, for example:
- Get-VM blank1,blank2,blank3 | Move-VM -DestinationHost savdalhv02
The problem is, this would Live Migrate blank1, and after that finished, it would Live Migrate blank2, then after that finished, Live Migrate blank3 and so on. But it isn't performing a simultaneous Live Migration, which is possible in.
One solution is to use the -parallel option, available in PowerShell 3.0 workflows to trigger the Live Migrations to occur in parallel. For example:
- Workflow Invoke-ParallelLiveMigrate
- $VMLIST = get-vm blank1,blank2,blank3,blank4,blank5,blank6
- ForEach -Parallel ($VM in $VMLIST)
- Move-VM -Name $VM.Name -DestinationHost savdalhv02
The Live Migrations will now occur in parallel (make sure your Hyper-V hosts are configured with the necessary setting for the number of concurrent Live Migrations you want to perform on both the source and destination Hyper-V hosts).