VMware Cloud Community
marshawnm
Contributor
Contributor
Jump to solution

Multiple Templates found in vSphere

All

I am attempting to run a script that will create multiple VM's from a template and then customize each by way of a OSCustomization.

The script reads as (very simple)

New-vm -vmhost xxxxxxxxx -Name xxxxxxxx -Template TEMPLATE-2K8R2EEx64 -Datastore xxxxxxxxxx -OSCustomizationspec OSCust-TEMPLATE-2K8R2EEx64

The error I am reacieving is

New-VM        The specified parameter 'Template' expects a single value, but your name criteria 'TEMPLATE-2K8R2EEx64' corresponds to multiple values.
h\VMware\PowerCLI\scripts\MultiVMDeploy.ps1:1 char:7
<<<  -vmhost (HostName) -Name CEIVIRDAS0060 -Template TEMPLATE-2K8R2EEx64 -Datastore VMFS08 -OSCustomizationspec OSCust-TEMPLATE-2K8R2EEx64
Which suggest that there are TWO Templates with the same name...so
I ran Get-Template -Name  TEMPLATE-2K8R2EEx64 in PowerCLI I do in fact see two TEMPLATES with the same name (see below).
[vSphere PowerCLI] C:\Stash\VMware\PowerCLI\scripts> Get-Template -Name TEMPLATE-2K8R2EEx64
Name                 Id
----                 --
TEMPLATE-2K8r2EEx64  VirtualMachine-vm-61686
TEMPLATE-2K8R2EEx64  VirtualMachine-vm-66484
But in vSphere there is only one Template with the name " TEMPLATE-2K8R2EEx64"
I can't figure out where the "other" Template object with the same name is located. Help anyone?
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Use this to see the blue folder where the template is supposedly located.

Get-Template | Select Name,@{N="Folder";E={(Get-View $_.ExtensionData.Parent).Name}}


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

View solution in original post

0 Kudos
3 Replies
cblomart
Enthusiast
Enthusiast
Jump to solution

Strange...

I've only seen this when connecting to multiple vcenters...

As names are specific to a datacenter (if i remember well) it means that templates with the same name cannot coexist in one datacenter.

You could browse the "infrastructure" by trying to lookup the parent of the templates (follow the trail up to the datacenter).

LucD
Leadership
Leadership
Jump to solution

Use this to see the blue folder where the template is supposedly located.

Get-Template | Select Name,@{N="Folder";E={(Get-View $_.ExtensionData.Parent).Name}}


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

0 Kudos
marshawnm
Contributor
Contributor
Jump to solution

LucD

Thanks for this command this pointed me to a folder in our DR environment where the template had been copied for testing.  Thanks again.

0 Kudos