Create Windows Machine Builds With Packer

While it supports Windows and Linux, creating an OS image is vastly different between the two. In this article, I will focus on how Packer is used for Windows OS image creation.

As I wrote in a previous article, Packer is a Hashicorp, open-sourced operating system image build tool. The specialty of Packer is the ability to create an artifact to multiple platforms (AWS, Azure, VMware etc.), all from one configuration. In addition, Packer supports the creation of both Linux and Windows images, allowing for a single method for image creation.

Learning Resources

When learning a new technology, I find that looking at examples of how others use it is very helpful. The best resource I have found for using Packer with Windows is Stefan Scherer’s Github repository which is a fork of Joe Fitzgerald’s repository. In these two repositories you will find great examples of how Windows builds are automated using a combination of tools. I will use one of Stefan’s Packer templates for Windows 10 to illustrate how Packer works with Windows.

Autounattend File

Perhaps the most important aspect of automating a Windows OS installation is the autounattend.xml file. It is important to note that this is not specific to Packer, as anyone can use this to automate Windows installation. By default, when you boot to a Windows OS installation disk, Windows will prompt the user with installation options, such as choosing the disk to install Windows to. All of these options can be set in the autounattend.xml file, which needs to be located on a removable drive. To do this in Packer, you can mount these on the virtual machine via a floppy drive. This is an example of doing this in the builder section on a Packer template:

Read more at ipswitch.com

Leave a Reply

Your email address will not be published. Required fields are marked *