Templates for creating vagrant boxes
PowerShell Ruby HTML Batchfile Shell
Latest commit 9af4b46 Jan 15, 2017 @fujiiface fujiiface committed with Update cleanup.ps1 (#74)
Changed 'Del' to 'Remove-Item' based on a warning in Visual Studio Code: "'Del' is an alias of 'Remove-Item'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content."



A Packer template that simplifies the creation of minimally-sized, fully patched Windows Vagrant boxes.

This repo and much of its content are covered in detail from this blog post. Also see this post specifically for the Nano Server template.


You need the following to run the template:

  1. Packer installed with a minimum version of 0.12.1.
  2. VirtualBox - Tested with 5.1.12
  3. Berkshelf - Used to find and vendor Chef cookbook dependencies. This is easist installing via the ChefDK

Vendoring the cookbooks

The Windows 2016 templates use the packer-templates Chef cookbook to provision the image. The cookbook located in cookbooks/packer-templates has dependencies on a few community cookbooks. These cookbooks need to be downloaded. To do this:

  1. cd to cookbooks/packer-templates
  2. Run berks vendor ../../vendor/cookbooks

This downloads all dependencies and saves them in vendor/cookbooks. From here packer will upload them to the image being built.

Invoking the template

Invoke packer to run a template like this:

packer build -force -only virtualbox-iso .\vbox-2016.json

Using the Hyper-V templates

The Hyper-V templates use the Hyper-V builder currently in Taliesin Sisson's PR #2576 to the packer repo. See this post with full instructions on building and using this PR.

Converting to Hyper-V

This repo includes PowerShell scripts that can create a Hyper-V Vagrant box from the output VirtualBox .vmdk file. This repo leverages psake and Chocolatey to ensure that all prerequisites are installed and then runs the above packer command followed by the scripts needed to produce a Vagrant .box file that can create a Hyper-V file.

See this blog post for more detail on converting VirtualBox disks to Hyper-V.

Troubleshooting Boxstarter package run

Boxstarter is used by some templates for initial provisioning. Due to the fact that provisioning takes place in the builder and not a provisioner, it can be difficult to gain visibility into why things go wrong from the same console where packer is run.

Boxstarter will log all package activity output to $env:LocalAppData\Boxstarter\boxstarter.log on the guest.