Hi Guys,
In my environment we have virtual machines split over two data stores. I'm trying to migrate all the disks from one data store to another using the following code.
$HD = get-harddisk -Datastore "f2as01_nfs_hoss01"
foreach ($i in $HD) {
Move-HardDisk -HardDisk $i -Datastore "f1aa01_nfs_hoss01" -Confirm:$false
}
However i get the following error:
Move-HardDisk : 26/03/2014 12:53:40 Move-HardDisk The specified parameter 'Datastore' expects a single value, but your name criteria 'f1aa01_nfs_hoss01' corresponds to multiple values.
At C:\Users\grantg\AppData\Local\Temp\5eed2c4f-a0e2-4a09-8855-1efcf58fbc90.ps1:7 char:14
+ Move-HardDisk <<<< -HardDisk $i -Datastore "f1aa01_nfs_hoss01" -Confirm:$false }
+ CategoryInfo : InvalidResult: (System.Collecti...dObjectInterop]:List`1) [Move-HardDisk], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_MoreResultsThanExpected,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.MoveHardDisk
I know PS does not like spaces but could there be an issues with underscores too?
Regards
Mr G
Hello,
as commented, maybe there are more than 2 datastores with the name "f1aa01_nfs_hoss01" (in different hosts).
When using powercli, it isn't a good praxis to have more than one datastore with the same name.
You should change the name of the datastore(s), in order to have just one datastore with the same name.
Until you do this, the powercli script will fail!
Best regards,
Pablo
For some reason it finds more than one datastore with that name. Try Get-Datastore "f1aa01_nfs_hoss01" and check what the results are.
Hello,
as commented, maybe there are more than 2 datastores with the name "f1aa01_nfs_hoss01" (in different hosts).
When using powercli, it isn't a good praxis to have more than one datastore with the same name.
You should change the name of the datastore(s), in order to have just one datastore with the same name.
Until you do this, the powercli script will fail!
Best regards,
Pablo
You may also want to specify the Datacenter and/or cluster name explicitly first. Get-Datacenter "Name" | get-datastore "Name"