VMware Cloud Community
Squigglymonkey
Enthusiast
Enthusiast
Jump to solution

can powercli import a template

I moved a couple of templates over to another ESX host. Can I import/register or somehow get them to work?

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, if the storage on which the Template is located is visible on the target ESXi node, you can use the New-Template cmdlet with the TemplateFilePath parameter to register the template.


But if that storage is only attached for a short while, you will have to clone the Template.

That can be done with the Template parameter on that same cmdlet.


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

View solution in original post

0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

You have to give a few more details.
Are these ESXi nodes under the same vCenter?

Is there shared storage between those ESXi nodes?


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

0 Kudos
Squigglymonkey
Enthusiast
Enthusiast
Jump to solution

There are 2 vcenter clusters. I can have a LUN/datastore presented back and forth between them.
I created a couple of templates on one vcenter, placed them on the transferrable datastore and had it presented to the other vcenter cluster.
I see a cmdlet new-template, it kind of looks like this is possibility.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, if the storage on which the Template is located is visible on the target ESXi node, you can use the New-Template cmdlet with the TemplateFilePath parameter to register the template.


But if that storage is only attached for a short while, you will have to clone the Template.

That can be done with the Template parameter on that same cmdlet.


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

0 Kudos
Squigglymonkey
Enthusiast
Enthusiast
Jump to solution

struggling.... lets call the vcenter 'vcenter2' and the transferrable lun/datastore 'transfer1' in it is a container named contatinerDB1 and in that are the  template files including templateDB.vmtx

I connect to the vcenter2 with powercli and run this command

new-template -templatefilepath "transfer1 containerdb1\templatedb.vmtx" -location "transfer1 containerdb1"
I get an error could not find vi container  transfer1 containerdb1
I would like to get this template registered where it is, I'd rather not copy it anywhere, as that would just be more time..... I'll create a VM from it and I'll be done with it then!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You didn't mention that the Template was stored in a Container.
That changes the story.

You would have to replicate the Container to the other vCenter.
But cloning a Template from a Container is not possible at the moment afaik.


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

0 Kudos
Squigglymonkey
Enthusiast
Enthusiast
Jump to solution

Container is probably the wrong word, it's a folder not in a kuernetes container

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You mean a Folder in the vCenter hierarchy?


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

0 Kudos
Squigglymonkey
Enthusiast
Enthusiast
Jump to solution

What worked was:

new-template -TemplateFilePath "[DatastoreName] foldername\template.vmtx" -vmhost hostname -location "folder-in-vcenter"