VMware Horizon Community
mmonkman
Enthusiast
Enthusiast
Jump to solution

Add-HVDesktop "Item has already been added. Key in dictionary"

Horizon 7.10

vCentre 6.7

Hi.  Having problems using the Add-HVDesktop cmdlet trying to add machines to a manual desktop pool.

The first time I run the command it's successful, and vdi01 is added to the pool.

Add-HVDesktop -PoolName 'manualDedicatedPool01' -Machines 'vdi01.domain.com'

When running the command again to add vdi02;

Add-HVDesktop -PoolName 'manualDedicatedPool01' -Machines 'vdi02.domain.com'

I receive the following error;

Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'vdi01'  Key being added: 'vdi01"

At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:508 char:5

+     $machineDict.Add($vMachine.name,$vMachine.id)

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : ArgumentException

Add-HVDesktop : Failed to get any Virtual Center machines with the given machines parameter

At line:1 char:1

+ Add-HVDesktop -PoolName 'manualDedicatedPool01' -Machines 'gi ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-HVDesktop

I have no clue why the error refers back to vdi01 even though I'm trying to add vdi02?

Any help appreciated.


Thanks,

Reply
0 Kudos
1 Solution

Accepted Solutions
mmonkman
Enthusiast
Enthusiast
Jump to solution

Linked vcenters and duplicate vm names during testing.  Now resolved.

View solution in original post

Reply
0 Kudos
1 Reply
mmonkman
Enthusiast
Enthusiast
Jump to solution

Linked vcenters and duplicate vm names during testing.  Now resolved.

Reply
0 Kudos