Tsunati University - Register Today

Automate the Creation of a Windows Server 2022 VMware Template

This article will describe the method that I use to build my Windows Server Templates in vSphere.  After years of building, tweaking, disabling services, etc, I came across Packer from Hashicorp. There are several blog articles out there from people describing how they have used Packer to create a variety of images. For me, I’ve borrowed, tweaked, and modified until I have arrived at a point of being happy with what I’ve come up with. 

  1. Automated Windows Server Deployment
    • Use Packer as the automation utility
    • Need to be able to deploy Windows Server 2022, 2019, or 2016
    • Fresh automated install (no cloning for template creation)
    • Install VMware Tools
    • Install current Windows Updates
    • Enable RDP
    • Disable Firewall
    • Install Chocolatey (package manager with over 8,500 packages)
    • Use Chocolatey to install:
      • Notepad ++
      • MobaXterm
      • 7-Zip
      • Google Chrome
      • BGInfo
      • Adobe Reader
      • Sysinternals
      • LogExpert
  2. Deploy and Use
    • Download bundle here
    • Unzip to a local directory on a Windows platform
    • Modify the.json file
      • Log in credentials for the VCSA
      • Datacenter, Cluster, Datastore, etc.
      • Change iso location to correct location of iso in your vSphere environment
      • Be sure to have an existing folder named “Templates” in your vSphere inventory
    • Execute install
      • From a command prompt on your windows machine:
      • Type “packer.exe build nameoffile.json” and press Enter.
    • What you should expect during deployment
      • A new virtual machine will be created in your vCenter inventory
      • It will have the windows iso attached.
      • It will be automatically powered on.
      • It will begin the Automated, Unattended installation of Windows.
      • Once Windows has been installed, a number of in-guest operations will occur.
        • VMware Tools installation
        • Enable RDP
        • Disable Network Discovery
        • Windows Updates will be installed.
        • Chocolately will be installed
        • Applications will be installed using Chocolately
        • Windows will shut down and power off the virtual machine.
      • Once the virtual machine has been powered off, it will be converted to a template.
      • The entire process will take about an hour. (depending on speed of infrastructure, internet download speed, and number of windows updates that need to be installed.
Scroll to Top