Hello,
I am working on a small script to deploy some VM's from a template. I keep getting the following error:
New-VM : 10/02/2012 11:37:04 New-VM An item with the same key has alr
eady been added.
At C:\scripts\deploy-template.ps1:46 char:7
+ New-VM <<<< -Name $vmname -Template $template_name -VMHost $destination_host
-Datastore $datastore_name -Confirm:$false
+ CategoryInfo : NotSpecified: (:) [New-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.NewVM
At the moment I get this error I can see the machine being deployed in vCenter but it seems it wants to deploy another VM and thus spawns the error.
The small script I use:
$vcenter = "vcenter.lab.local"
$vmname = "testing"
$destination_host = "host01.lab.local"
$template_name = "tpl-clean"
$datastore_name = "00-local"
Connect-VIServer -Server $vcenter -Protocol https
New-VM -Name $vmname -Template $template_name -VMHost $destination_host -Datastore $datastore_name
Disconnect-VIServer -Server $vcenter -Confirm:$false
Any help here?