How can I move multiple VMs in parallel using powercli?

Right now, I'm using the following scriptblock to move VMs in parrallel:

Start-Job -ScriptBlock {
    Add-PSSnapin VMware.VimAutomation.Core
    Add-PSSnapin VMware.VimAutomation.License
    Add-PSSnapin VMware.DeployAutomation
    Add-PSSnapin VMware.ImageBuilder
    Connect-VIServer MyVIServer
    Move-VM -VM $vm -Destination $TargetHost

This doesn't seem very efficient, and doesn't completely work (the jobs never complete). I shouldn't have to add the snap-ins and connect to the VIServer every time, but I don't know if there is a way around it. Is there any way to move multiple VMs at the same time and monitor when they have completed?

Also, the each VM won't necessarily go to the same ESX host, so I need to run the Move command separately for each one.


Move-VM has a -RunAsync parameter, which looks like it ought to do what you need.

Need Your Help

Programmatically trigger an onclick event?

javascript javascript-events click onclick

I am trying to simulate an asynchronous file upload using an iframe. Here is my markup:

Stop StoryBoard from been launched at project startup

c# visual-studio-2010 animation storyboard blend

I've created a project in Visual Studio and I opened it in Blend so I can do some animations.