简体   繁体   English

如何使用powercli并行移动多个VM?

[英]How can I move multiple VMs in parallel using powercli?

Right now, I'm using the following scriptblock to move VMs in parrallel: 现在,我正在使用以下脚本块来并行移动VM:

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. 我不必每次都添加管理单元并连接到VIServer,但是我不知道是否有解决办法。 Is there any way to move multiple VMs at the same time and monitor when they have completed? 是否可以同时移动多个VM并监视它们的完成时间?

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. 另外,每个VM不一定要进入同一ESX主机,因此我需要分别为每个VM运行Move命令。

Move-VM具有-RunAsync参数,该参数看起来应该可以执行所需的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM