My Profile Photo Title

Thoughts about DevOps and automation from a Windows guy

VMware Template Creation and Managment with Packer feature image

VMware Template Creation and Managment with Packer

For most VMware administrators, managing VM templates is a manual and tedious task that is probably given to the new person on the team as a cruel form of initiation. It doesn't have to be this way. This post will cover how you can utilize a few awesome technologies to produce fully automated VMware templates and deploy those templates into your envionrment.


  • Chocolatey - Package management for Windows.
  • Packer - Automates the creation of machine images.
  • VMWare Workstation - Desktop virtualzation.
  • psake - A build automation tool. Use it. Love it.
  • BoxStarter - Repeatable, reboot resilient Windows environment installations using Chocolatey packages.
  • PowerCLI - PowerShell module for managment VMware vSphere.
  • Artifactory - Artifact repository manager.
  • ovftool - Command-line utility for importing and exporting OVF packages.
  • curl - Command-line utility for transfering data.

Build server

First off your going to want to provision a build server that this process will run on. For this post, I’m going to use a vanilla but fully patched Windows 2012 R2 VM. You’re going to want to assign enough resources (vCPU and RAM) to this VM in order to run VMware Workstation. You’ll also want to assign a decent amount of storage to handle the VMWare Workstation VM and associated artifacts as part of the build process.

Yes, we’re going to be using nested virtualization (having a VM run another VM to produce another VM). That’s very meta isn’t it :)

Build server resources

  • VM: Windows 2012 R2 Standard
  • vCPU: 2
  • vRAM: 6GB
  • Storage: C:\ 100 GB D:\ 50 GB

We’re going to need a fairly big C drive as Packer will copy the .vmdk produced during it’s build phase to $env:temp during it’s post-processor phase. These temporary files will be automatically cleaned up by Packer.

Github issue regarding Packer temp directory usage

Build Server Software

Install the following software on the build server with Chocolatey. Feel free to use other installation methods if you like.

Chocolatey, Packer, psake, and curl

if(!($env:ChocolateyInstall) -or !(Test-Path "$env:ChocolateyInstall")){
    iex ((new-object net.webclient).DownloadString(""))
if(!(Get-Command git -ErrorAction SilentlyContinue)) { cinst git -y }}
if(!(Get-Command packer -ErrorAction SilentlyContinue)) { cinst packer -y }
if(!(Test-Path $env:ChocolateyInstall\lib\Psake*)) { cinst psake -y }
if(!(Test-Path -Path 'C:\ProgramData\chocolatey\lib\curl\tools\curl.exe')) { cinst curl -y }

VMWare Workstation

Grab a copy of VMWare workstation and run the following command to install.

.\VMware-workstation-full-12.1.0-3272444.exe /s /v /qn EULAS_AGREED=1 SERIALNUMBER='<YOUR SERIAL NUMEBR' AUTOSOFTWAREUPDATE=0


Download the latest version of PowerCLI and run the following command to install. You can start here.

.\VMware-PowerCLI-6.3.0-3639347.exe /b"C:\Windows\Temp" /VADDLOCAL=ALL /S /V"/qn ALLUSERS=1 REBOOT=ReallySuppress"


Download ovftool from

Show your support

Become a GitHub Sponsor
Become a Patron

Like books? Check these out!

You might also like:

Sharing is caring