VMware Cloud Community
nufc09
Contributor
Contributor

Error running Get-Task Cmdlet first time against Virtual Center

I was wondering if anyone had seen this error before when running Get-Task for the first time?

Get-Task : 10/07/2012 16:58:41     Get-Task          An item with the same key has already been added.

At line:1 char:9

+ get-task <<<<

     + CategoryInfo          :NotSpecified: (:) [Get-Task],

VimException

     + FullyQualifiedErrorId :

Core_BaseCmdlet_UnknownError,VMware.VimAutomatio

     n.ViCore.Cmdlets.Commands.GetTask

The command still runs successfully and if I run Get-Task again it runs with no error.  If I disconnect from the VC and then reconnect and run the command again I get the error again.

This error is also occurring for any task I run for the first time after connecting to the VC..ie creating a new VM

if I run get-vmhost server.name | new-vm -name test01 I will get the same error but for New-VM   An item with the same key has already been added.

Interestingly the progress indicator doesn't display but the VM is still created successfully.

If I run the same command to create a VM again with a different name there is no error, the progress indicator displays and the VM is created

I am running powercli 5.0

Vcenter 5.0

Esxi 5.0

0 Kudos
4 Replies
LucD
Leadership
Leadership

Try upgrading to PowerCLI 5.0.1 first


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
nufc09
Contributor
Contributor

Thanks for the reply Lucd

Unfortunately I am not able to upgrade at the moment.  I do have a test virtual center and cluster running the same versions and i cant replicate the behaviour.

I am running a script that reconfigures many settings for vm's contained in a csv file. ie changes port group,moves to destination folder,resets resource settings etc  the error occurs on the first task of the first vm which in this case is the set-networkadapter cmdlet....again it does complete successfully  and continues on and completes, however the performance is poor compared to my way lower spec test environment.  Could the error be impacting performance?

0 Kudos
adamsavagex
Contributor
Contributor

I began seeing this error after upgrading my infrstructure to 5.1.. After scouering google i came across this article.

http://alexho.wordpress.com/2008/11/17/failed-to-export-virtual-appliance-an-item-with-the-same-key-...

This is obviously a different case where the person isnt using powercli but it is the same error.. So i tried the fix anyway on my VMs and it seems to have resolved the issue.

Consolidate the snapshots on the VM (even if the VM says it has no snapshots)  - the the consolidate option is available run it - it will take a upto a minute to run. Then try your NEW-VM clone task again..

Hope this helps.

Thank you,

Adam Savage

0 Kudos
LucD
Leadership
Leadership

Thanks for sharing.

I would have never thought that a consolidate would fix the problem.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos