VMware Cloud Community
ajcruz
Contributor
Contributor
Jump to solution

Create a VM From Template With vApp Properties

I have created a script that successfully creates a VM from template with this:

New-VM -Template $template -Name $newvmName -VMHost $esx -Datastore $ds -DiskStorageFormat Thin -Location $folder

but the vApp configuration is not copied over to the new VM. How do I include the vApp configuration and how would I modify the vApp property values on the new VM?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

There are no PowerCLI cmdlets to do that.
But William wrote some functions based on the API methods that allow you to do that.
See Updating OVF properties for a VM using vSphere API and PowerCLI


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

The vApp configuration is not included in any of the VM in that vApp.
You can clone a vApp configuration to a new vApp, but with a method, not a cmdlet.
See for example Solved: Re: Clone Vapp Boot Options - VMware Technology Network VMTN


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

0 Kudos
ajcruz
Contributor
Contributor
Jump to solution

Thanks for the reply. It's a little confusing for a non-vmware guy, but I'm not working with an actual vApp, rather I'm trying to create a single VM from a template that has vApp properties.

If I right-click on a VM template in the GUI and create a new VM from the template, all the vApp properties are copied over to the new VM. Trying to figure out how to replicate that in PowerCLI.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

There are no PowerCLI cmdlets to do that.
But William wrote some functions based on the API methods that allow you to do that.
See Updating OVF properties for a VM using vSphere API and PowerCLI


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

0 Kudos
ajcruz
Contributor
Contributor
Jump to solution

Thanks. I'm doing this as part of a Packer post-processor and since I already had the spec created for the original VM I just re-used the spec and applied it to the new VM, then used the Set-VMOvfProperty function from the PowerValidatedSolutions module mentioned by William Lam in the link you provided.

0 Kudos