How to use Packer to build a Windows Server template for VMware vSphere

Guillermo Musumeci
4 min readDec 17, 2019

Note: this story is compatible with Packer v1.5.x or previous versions. For Packer v1.6.x versions, please look to this story.

Packer is an open-source tool used to create virtual machine templates from a .json file.

To automatize the creation of templates in VMware vSphere, there are two major approaches:

  1. Use the VMware-iso provider. This provider creates VMware VMs from an ISO file as a source. It currently supports building virtual machines on hosts running VMware Fusion for OS X, VMware Workstation for Linux & Windows, VMware Player on Linux, and the free VMware ESXi Hypervisor.
  2. Use the vSphere-iso provider. This provider created by JetBrains builds VMs on VMware vSphere directly using vSphere API (this article).

Update (March 2020): The vsphere-iso was merged into the official Packer repository and released with Packer since version 1.5.2.

In this story, we will use vsphere-iso to create a Windows Server 2019 or 2016 template using Packer for VMware vSphere with vCenter.

The idea of enabling SSH on ESXi hosts or using SSH keys will not work for most environments and vpshere-iso provides an elegant way to build templates using the API.

--

--

Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌