Virtual machine templates for Windows written in legacy JSON and Batch Scripting/JScript
Virtual machine templates for Windows written in legacy JSON and Batch Scripting/JScript
We're moving away from vagrant!
Archived on July 11, 2026.
Boxcutter is moving away from using legacy JSON/vagrant in favour of HCL and producing compressed images that can be loaded into the various hypervisors directly.
Now repos are per-hypervisor with all the OSes within them instead of being per-OS/per-distribution. Currently we're focusing on KVM/QEMU in https://github.com/boxcutter/kvm and we may target other hypervisors in the future.
Renamed the repo from
boxcutter/windowstoboxcutter/windows-batchas we may end up reusing the name for a new Windows effort. Though it is more likely that it will be in a repository calledboxcutter/hyperv.
This repository contains templates for Windows written in legacy JSON that can create Vagrant boxes using Packer.
64-bit boxes:
To build all the boxes, you will need both VirtualBox and VMware Fusion or Workstation installed.
A GNU Make Makefile drives the process via the following targets:
make # Build all the box types (VirtualBox & VMware)
make test # Run tests against all the boxes
make list # Print out individual targets
make clean # Clean up build detritusTo build one particular box, e.g. eval-win7x86-enterprise, for just one provider, e.g. VirtualBox, first run make list subcommand:
make listThis command prints the list of available boxes. Then you can build one particular box for choosen provider:
make virtualbox/eval-win7x86-enterpriseWhen building any the boxes, each template will download a number of files from
the internet in order to provision the box and then optimize its disk after
the install is successful. The ability to download is managed through the work
of two scripts. These scripts are floppy/01-install-wget.cmd and then
the floppy/_download.cmd utility.
Once the download scripts have been bootstrapped, the boxes will then be used to download and install a number of applications that will be used to prepare the template prior to completing its build.
The job of this script is strictly to bootstrap wget.exe on the box and is one
of the first things done after the operating system has been installed in the
image. The bootstrapping procedure is an attempt to download the most recent
version of wget.exe from the host https://eternallybored.org/misc/wget/current/wget.exe.
This way the floppy/_download.cmd script can use it during the provisioning
stage to download other necessary tools.
The bootstrap process is done by first checking if floppy/_download.cmd has
already been installed (by copying into the SystemRoot). If it has been installed,
the script will then simply use it to download the latest version of wget.exe
from the aforementioned URL to the SystemRoot. If it hasn't been installed, the
script will then try a number of methods in order to bootstrap the tool.
Powershell - The script will first attempt to transfer the file with Powershell. This should work on most boxes and is the most flexible as it doesn't require tampering with the disk. On older systems, Powershell may not support some of the newer Tls protocols and thus might be unable to download from certain sites. In those cases, there's no choice but to attempt the next method.
BITSAdmin - The next method the script will try to use is by creating a
job using the "Background Intelligence Transfer Service". This is done by
checking for the existence of and using the BitsAdmin.exe executable to
create a job. If the job can be created, the service will then download the
requested file to the that's provided. This method can be configured by
modifying the DISABLE_BITS field in the floppy/_packer_config.cmd
configuration. Please review that file for more information.
Curl.exe - If the prior two methods have failed in bootstrapping wget.exe,
the box will have no choice but to bootstrap wget.exe using a 3rd-party
binary that was included on the floppy disk during the build. This binary
is a minimalistic compile of "curl.exe" that is 32-bits and has been
configured with minimal features in order to fall back on if all else fails.
This binary is located at 3rdparty/curl.exe and is built from the fork of
curl that can be found on github at arizvisa/curl-windows-nodeps.
Once wget.exe has been bootstrapped, this script can be used to download
arbitrary files from the internet in order to provision each box. This script
has a similar redundancy to the floppy/01-install-wget.cmd script in that
first it will attempt to download the requested file with Powershell. If it is
unable to perform this task with Powershell, it will fall back to the copy of
wget.exe that was bootstrapped. Afterwards, the BitsAdmin.exe tool will be
attempted depending on the value of the configuration variable DISABLE_BITS.
If BitsAdmin.exe fails to download the requested file or is disabled due to
the variable, the script will then fall back to using the curl.exe binary
which was bundled on the floppy disk by Packer.
Each of the available download methods can be influenced by changing the value
of their respective variables within the configuration. The primary wget.exe
downloader uses the contents of the WGET_OPTS variable for its parameters when
it is called. Similarly, the curl.exe fall-back downloader use the contents
of the CURL_OPTS variable as its parameters. The default parameters that are
defined in the project's configuration specify to retry a download up to 64 times,
and to repeatedly retry the download even if the connection has been refused. To
change these options, please refer to the Packer Global Configuration.
Once downloading has been bootstrapped and the box is able to be connected to by the Packer process, the templates include a number of provisioning steps that are designed to optimize the template prior to its deployment. A number of these steps require downloading files from the Internet and running an external tool. After executing all of the provisioning steps, the templates will clean up followed by completing the build.
The following tools are downloaded in order to provision each individual box.
The very first thing that most of the templates do is download the vagrant public key and install them into the template. This projects is used for producing vagrant boxes and thus the installation of the vagrant public key is required in order for Vagrant to be able to connect to them.
The vagrant public key is downloaded directly from @mitchellh's
repository for vagrant at the https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
url. If the user wishes to change this url or specify their own public key, this
can be accomplished by changing the VAGRANT_PUB_URL variable.
If any configuration management tools were specified for the build, this step
will proceed to install them into the box. This projects supports a number of
configuration managers which are configurable using the Makefile.local override
option. Please review that section for more information on what managers are
supported and how to specify them.
Depending on which builder was specified for the box that is being built, this step will download and install any tools that can be used to add additional features to the template when it is deployed. In some cases these tools can add significant performance or very powerful features to the virtual machine that is built.
To install these tools, the first thing that is installed is 7-zip which is
hosted at http://7-zip.org. The 7-zip archiver is used as a
general utility for extracting the contents of archives that compose any of the
tools that are required by the build of the template. By default 7-zip is
installed from either the http://7-zip.org/a/7z1604.msi
url for a 32-bit template, or the http://7-zip.org/a/7z1604-x64.msi
url for a 64-bit template. These urls can be configured in the Packer Global Configuration
by using the SEVENZIP_32_URL variable for 32-bit templates, and likewise the
SEVENZIP_64_URL variable for 64-bit templates. When a template is done being
provisioned, the 7-zip application will then be uninstalled prior to completion
of the build.
One such set of tools comes with VirtualBox and is known as the VirtualBox Guest
Additions ISO. This ISO allows one to manage some of the features that a VirtualBox
guest exposes to the user. The VirtualBox Guest Additions ISO is downloaded from
the http://download.virtualbox.org/virtualbox/5.1.30/VBoxGuestAdditions_5.1.30.iso
url. Once downloaded, 7-zip will be used to extract the relevant files and then the
"Guest Additions" will be installed into the image. If the user wishes to change
this URL, they can specify an alternative location by assigning it to the variable
VBOX_ISO_URL.
The other major set of tools comes along with the VMware platform and is simply
named "VMware Tools". These tools allow for features such as hardware acceleration,
mapping folders into the VM, file transfers, and copy/paste operations. These
tools are served as a .tar file from the https://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.5/5234757/windows/packages/tools-windows.tar
url. If the user wishes to use a different URL, this path can be changed by
setting the VMWARE_TOOLS_TAR_URL variable.
Depending on the filesystem, the hard disk of the template may become fragmented. Although for later filesystems this is not of significant importance, for virtual machines this can have large impact when the hard disk is to be compressed. This can greatly reduce the speed that compression and decompresion of the guest's hard disk may take.
Before defragmenting the hard disk, 7-Zip is checked to see if it's installed.
If it isn't, then it is downloaded and installed due to it being necessary for
extracting the contents of the UltraDefrag software.
The default URL that 7-zip is fetched from is http://7-zip.org/a/7z1604.msi
for 32-bit systems, and then http://7-zip.org/a/7z1604-x64.msi
for 64-bit. If the user wishes to change the path to download 7-zip from, this
can be done by modifying the SEVENZIP_32_URL variable or the SEVENZIP_64_URL
variable depending on the platform's architecutre.
At this point, an archive for the UltraDefrag tool at http://downloads.sourceforge.net/ultradefrag/ultradefrag-portable-7.0.2.bin.i386.zip is then downloaded for a 32-bit platform, or the archive from the [http://downloads.sourceforge.net
No open issues yet, or sync has not completed.