Resources and guide to creating Windows vagrant base boxes for use with the vagrant-windows plugin
- VirtualBox
- Vagrant
- The
bindlerplugin
vagrant plugin install bindler
vagrant bindler setup
To prepare a Windows VM for use as a vagrant base box
- Install windows in a VirtualBox VM with the following options
- user:
vagrant - password:
vagrant - install only important updates
- user:
- Install important updates through windows update (restart many times)
- Ensure the following services are set to automatic from the
ServicespanelBase Filtering EngineRemote Procedure Call (RPC)DCOM Server Process LauncherRPC Endpoint MapperWindows Firewall
- Run a command prompt as administrator and run the following to enable
Windows Remote Management (WS-Management)with the correct settings
winrm quickconfig -q
winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}
winrm set winrm/config @{MaxTimeoutms="1800000"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/service/auth @{Basic="true"}
sc config WinRM start= auto
- Go to
User Account Control Settingsand select never notify to turn off UAC - Go to
Local Security Policyand underSecurity Settings/Account Policy/Password Policydisable thePassword must meet complexity requirementsoption - Restart the VM to ensure all settings have been applied
- Shut down the VM
To create the vagrant base box from this directory
vagrant package --vagrantfile Vagrantfile --base VM_NAME --output BOX_FILE
where:
- VM_NAME is the name of the VM in VirtualBox
- BOX_FILE is the name of the output file, eg.
windows.box
Then to add the box to vagrant
vagrant box add BOX_NAME BOX_FILE
where
- BOX_NAME could be
windowsif the BOX_FILE waswindows.box