指定的参数“数据存储区”需要一个值,但是您的名称条件“ xxX-xx-xxx-xxx-LUN002”对应多个值

时间:2018-10-27 14:08:07

标签: powershell vmware powercli

我需要将VM从一个数据存储移动到同一主机上的另一个数据存储。从TESTVM_india移至xxX-xx-xxx-xxx-LUN002 移动时,我收到如下错误消息

Move-VM : 10/27/2018 1:25:03 PM    Move-VM    The specified parameter 'Datastore' expects a single value, but your name criteria 'xxX-xx-xxx-xxx-LUN002' corresponds to multiple values. 
At C:\Users\suganthanraj\Desktop\DS_Migration.ps1:130 char:1
+ Move-VM -VM $VMtoMove.VMName -Datastore "$VMMoveToDS" -VMotionPriority 
High
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (System.Collecti...dObjectInterop]:List`1) [Move-VM], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_MoreResultsThanExpected,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

 Move-VM : 10/27/2018 1:25:20 PM    Move-VM        Either Destination or Datastore must be specified.    
 At C:\Users\suganthanraj\Desktop\DS_Migration.ps1:130 char:1
 + Move-VM -VM $VMtoMove.VMName -Datastore "$VMMoveToDS" -VMotionPriority High
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Move-VM], InvalidArgument
+ FullyQualifiedErrorId : Core_MoveVm_TryValidateParameterList_InvalidArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

如果您使用的是PowerCLI 11,则Move-VM中存在一个已知问题,它要求指定“目标”参数。

将您的代码更新为以下内容,就可以了:

Move-VM -VM $VMtoMove.VMName -Datastore "$VMMoveToDS" -VMotionPriority High -Destination $VMtoMove.VMHost