Vmware VM通过PowerCLI从一台主机移动到另一台主机

时间:2014-04-30 11:55:08

标签: vmware-server

您好我们有6个Vspher服务器,我的Vcenter是基于Linux的,版本是Vsphere 5.5。

我们正在尝试通过PowerCLI脚本自动管理我们的VMware环境。

我在互联网上获得了一个脚本但却出错了。感谢Lucd和Kunaludapi的帮助。

需要一些帮助。

Move-VM : Cannot convert 'System.Object[]' to the type 'VMware.VimAutomation.Vi
Core.Types.V1.Inventory.VIContainer' required by parameter 'Destination'. Speci
fied method is not supported.
At C:\Scheduled tasks\Vmware DRS Script.ps1:103 char:53
+                        $objVM | move-vm -destination <<<<  (get-vmhost $strDe
st);
    + CategoryInfo          : InvalidArgument: (:) [Move-VM], ParameterBinding
   Exception
    + FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCor
   e.Cmdlets.Commands.MoveVM

1 个答案:

答案 0 :(得分:-1)

谷歌是你的朋友

http://kc-tek.blogspot.co.nz/2012/06/vmotion-vms-from-one-given-host-to.html

As always when using PowerCLI you have to connect to your vCentre server
Connect-VIserver SeverName
Issue the command to 'get' the VMs from the host you want to move them off and then 'move' them to the target host.
Get-VM -Location "HostName" | Move-VM -Destination (Get-Vmhost "NewHost")