Highlighted
Enthusiast
Enthusiast

Clone to Template in Library with API or PowerCLI?

Looking for a way to Clone an existing Template to a template in content library. Currently I have a packer process that builds a server in vCenter and converts it to a template. I want to move that template to content library with code, not rt clicking and cloning it. 
0 Kudos
4 Replies
Highlighted
User Moderator
User Moderator

Did you already try the New-VMTX function from William's ConetntLibrary module?


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

0 Kudos
Highlighted
Enthusiast
Enthusiast

I read it but wasnt sure if there was a native way to do this in powercli without having to import a new module. Im looking at possibly doing this with Ansible too. 

Right now I have an azure devops pipeline that uses packer to build the VM and terraform to test itetc, once its dont I can run an ansible playbook, or use Williams module and have it run a powercli command. 

Ill give it a shot.. thanks!

0 Kudos
Highlighted
Enthusiast
Enthusiast

Looks like it only supports VMC which does me no good.

0 Kudos
Highlighted
Expert
Expert

I was trying to do the same thing and found Stuart Yerdon blog post works well when using it to create a new Content Library template in both 6.5 and 6.7.

My only issue with this method was updating an existing template. If the existing Content Library item is replicating to a subscribed content library OR a VM is being deployed from it while your image pipeline is trying to update the same item it will cause a collision and all comes to a halt for about 3 hours. To get around this I was checking for a deployment from it, if none then I delete the item and then create a new one via code in blog post.

VCP5-DV twitter - @ericblee6 blog - http://vEric.me