Hello All,
I'm seeing a strange issue when trying to add a new-disk to a VM through powershell
I use the following commands:
Add-PSSnapin VMware.VimAutomation.Core
connect-viserver -server $MyVC
$server='MyServer'
$vm=get-vm $server
$NewDisk= New-HardDisk -VM $VM -CapacityGB $DiskSize -StorageFormat $StorageFormat
When I execute it, the disk gets added but the following is thrown into the output:
New-HardDisk : 24/06/2013 11:04:22 | New-HardDisk | An item with the same key has already been added. |
At line:1 char:11
+ $NewDisk= New-HardDisk -VM $VM -CapacityGB $DiskSize -StorageFormat $StorageForm ...
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo | : NotSpecified: (:) [New-HardDisk], ViError | |
+ FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_NewVirtualHardDisk_ReconfigError,VMware.VimAutomation. |
ViCore.Cmdlets.Commands.VirtualDevice.NewHardDisk
When I rerun the command in the same powershell session then it gets executed without error.
Has anyone seen this behavior before?
Could this be a bug?
I've been looking for this error but this seems to be something very generic..
Many thanks in advance!
Filip
Hi Filip,
this looks like the same problem as already reported in First New-VM : An item with the same key has already been added.
Hi Filip,
this looks like the same problem as already reported in First New-VM : An item with the same key has already been added.