Skip to content

Instantly share code, notes, and snippets.

@uchagani
Last active August 9, 2016 09:46
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uchagani/48d25871e7f306f1f8af to your computer and use it in GitHub Desktop.
Save uchagani/48d25871e7f306f1f8af to your computer and use it in GitHub Desktop.
How to create a fast-booting windows guest for Vagrant

Requirements:

  • VirtualBox
  • Vagrant
  • Windows 8.1/Server 2008/Server 2012 ISO
  1. Create VM in VirtualBox manually and install OS
  2. Create vagrant user with password vagrant
  3. Turn off firewall
  4. Disable 'Windows Search' Service (only if u don't need it, i don't need it)
  5. Disable 'Windows Update' Service (only if u don't need it, i don't need it)
  6. Turn off UAC
  7. Turn off Windows Defender
  8. Install Guest Additions
  9. Install any other software you want.

##Run the following in Powershell in Administator mode:

  1. Make all networks "private"
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $nlm.getnetworkconnections()
$connections |foreach {
  if ($_.getnetwork().getcategory() -eq 0)
  {
      $_.getnetwork().setcategory(1)
  }
}
  1. Enable WinRm
Enable-PSRemoting -Force
  1. Configure WinRM
get-service winrm
Enable-PSRemoting -force
winrm qc -q  
winrm set winrm/config/client '@{TrustedHosts="*"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="2048"}'
winrm set winrm/config/winrs '@{MaxConcurrentUsers="100"}'
winrm set winrm/config/winrs '@{AllowRemoteShellAccess="True"}'
winrm set winrm/config '@{MaxTimeoutms="604800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
  1. Set Windows Remoting service to start Automatic and not Automation (delayed)

Now all you have to do is package the box up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment