A Packer build to make a pretty vanilla Windows 10 x64 box for use with VMWare Desktop or Virtualbox.
This project is just a clone of my other Windows Packer project with some very minor changes. Eventually the two projects will merge and form like Voltron.
In essence, the build does the following:
vagrant
user (as is the style)This project works great with Virtualbox, so don't bother shelling out for VMWare Fusion without trying VirtualBox first.
This guide will assume you zero knowledge of any or all of these systems.
mkdir ~/Packer_Projects/
) and cd
to that directory (e.g. cd ~/Packer_Projects/
).git clone https://github.com/luciusbono/Packer-Windows10
(if you don't have git
installed: here are instructions.md5 [path to iso]
in OSX FCIV -md5 [path to iso]
in Windows (download it here) -- Linux people are smarter than me and likely can just calculate the md5 hash through ether-magic. packer build -only=virtualbox-iso -var 'iso_path=[path to iso]' -var 'iso_md5=[md5 of iso]' packer.json
packer build -only=vmware-iso -var 'iso_path=[path to iso]' -var 'iso_md5=[md5 of iso]' packer.json
. packer build -only=parallels-iso -var 'iso_path=[path to iso]' -var 'iso_md5=[md5 of iso]' packer.json
packer build -only=hyperv-iso -var 'iso_path=[path to iso]' -var 'iso_md5=[md5 of iso]' packer.json
optionally, if you want to specify a different HyperV virtual switch other than "Default Switch" you can specify it in the switch_name
var. Waiting for WinRM to become available
- this is normal! If you actually access the console session on your VM you will see that it is getting updates from Microsoft's servers. This can easily take 30 minutes, so be patient. After the updates are all installed, Windows will turn it's WinRM service back on and Packer will continue with the build. vagrant box add --name [vagrant box name] [name of .box file]
. The name can be anything you want. For example, this command is valid for Virtualbox: vagrant box add --name windows10 virtualbox-iso_windows-10.box
mkdir ~/Vagrant_Projects/windows10
) and cd
to that directory (e.g. cd ~/Vagrant_Projects/windows10
)vagrant init [vagrant box name]
- for example vagrant init windows10
vagrant up
and once the box has been launched type vagrant rdp
vagrant
and the password: vagrant
.box
file that packer created. You may also delete your .iso
you downloaded if you wish. vagrant halt
. Destroy the box by typing vagrant destroy
The packer.json
file requires two variables to validate. You can confirm these with a packer inspect packer.json
$ packer inspect packer.json
iso_md5 =
iso_path =
switch_name = Default Switch
Builders:
hyperv-iso
parallels-iso
virtualbox-iso
vmware-iso
Provisioners:
powershell
windows-restart
Since there are two Builders, you also likely want to specify one or the other.
Valid options are virtualbox-iso
or vmware-iso
.
The other two variables, iso_md5
and iso_path
, are the path and the MD5 hash of the Windows 10 Enterprise trial ISO.
The update grabbing script is a bit of a grey-box, as I basically just hijacked it (as well as lots of other code) from this awesome project - which I think is the defacto standard for Windows / Packer relations - but I wanted a leaner build. This project started as a frankenstein build, but is turning more into a ground-up rewrite of a lot of other projects' scripts and code. With the exception of the update-windows.ps1
script, which I only modified very slightly, I will slowly go through all the code in this project and make sure I kill all the cruft.
If, for some reason, you have multiple hypervisors, but want to run this project in Virtualbox, for example, you need to specify the provider in your vagrant up
statement like so: vagrant up --provider=virtualbox
Almost nobody will fall into the camp, but it's worth mentioning. Have fun!
The vagrantfile template disables the SharedFoldersEnableSymlinksCreate
option. I'd rather default to an untrusted guest since most of my workflows do not require symlinks. To change this, just add config.vm.synced_folder ".", "/vagrant", SharedFoldersEnableSymlinksCreate: true
to your vagrantfile and do a vagrant reload
.
I ran into this issue on a Windows 10 host with this project. I submitted an issue. The resolution is to choose Use another account
and login with .\vagrant
as the login and vagrant
as the password. Unforuntately, it appears that one must log in with these credentials in this manner each time you vagrant rdp
(unless that issue says otherwise...).
vagrant rdp -- /public
will also force mstsc into "public mode" which will clear the credentials dialogs each time.