Use this when automating VMware templates.
Templates · VMware Automation
VMware template automation builds, updates and deploys VM templates and content library items, often with Packer, and applies guest customization specifications at deployment.
1. Templates/Content Library items are the source for VMs.
2. Build with Packer.
3. Version and publish to Content Library.
4. Retire old.
5. Test deployments.
Packer → template/library → deployments
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as duplicate names, stale inventory, task still running after client timeout, vCenter/host permission gaps, storage/network dependency failure and assuming task success shows guest service health, choosing the cases most relevant to vSphere template identity/version, guest customization, clone task, datastore/network placement and post-clone VM/guest verification.
Step 2 Common mistakes Narrow the fault
- Templates not patched.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Build templates with Packer.
- Publish via content library.
- Apply customization specs at deploy.
Get-Template— templatesGet-ContentLibraryItem— library items- Packer vsphere-iso builds — template pipeline
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
VM templates are master images from which new VMs are cloned with consistent OS, patches and agents. Automated provisioning clones from a template and applies a customization specification (hostname, IP, domain join) or cloud-init.
$spec = Get-OSCustomizationSpec 'Win2022-Domain'
New-VM -Name app-oslo-014 -Template 'tpl-win2022-2026-10' -VMHost esx03 `
-Datastore ds-ssd-01 -OSCustomizationSpec $spec
Keep templates current (monthly rebuild with Packer), version them in the name, store them in a content library to share across vCenters, and remove old versions once nothing references them.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in VMware Automation > Templates. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://developer.broadcom.com/powercli · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For vSphere template identity/version, guest customization, clone task, datastore/network placement and post-clone VM/guest verification, prefer typed fields and stable IDs over human presentation text.