문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top