Need help with vagrant-windows?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

453 Stars 88 Forks Other 361 Commits 2 Opened issues

Services available


Need anything else?

Contributors list


Build Status Code Climate Gem Version

This plugin is deprecated, please use Vagrant 1.6+ which natively supports Windows guests over WinRM.

This Vagrant plugin allows you to standup Windows guests using WinRM instead of SSH on older versions of Vagrant.

Getting Started

  1. Install the vagrant-windows plugin.
  2. Create and configure a Windows guest base box.
  3. Create a Vagrantfile.
  4. vagrant up


Vagrant 1.6 will natively support Windows guests, this plugin should not be used with Vagrant 1.6 or later.

  • For Vagrant 1.1 -> 1.5 execute
    vagrant plugin install vagrant-windows
  • For Vagrant 1.0 execute
    vagrant plugin install vagrant-windows --plugin-version 0.1.2

Creating a Base Box

Supported Guest Operating Systems: - Windows 7 - Windows 8 - Windows Server 2008 - Windows Server 2008 R2 - Windows Server 2012

Windows Server 2003 and Windows XP are not supported by the maintainers of this project. Any issues regarding any unsupported guest OS will be closed. If you still insist on using XP or Server 2003, this may help.

You'll need to create a new Vagrant base box. Create a new Windows VM in VirtualBox, configure some Windows settings (see below) then follow the Vagrant packaging instructions.

  • Create a vagrant user, for things to work out of the box username and password should both be "vagrant".
  • Turn off UAC (Msconfig)
  • Disable complex passwords
  • Disable Shutdown Tracker on Windows 2008/2012 Servers (except Core).
  • Disable "Server Manager" Starting at login on Windows 2008/2012 Servers (except Core).
  • Enable and configure WinRM (see below)

WinRM Configuration

These commands assume you're running from a regular command window and not PowerShell.

   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

NOTE: For the WinRM service to work in Windows 7, the network profile has to be changed from Public to Work. To ensure that networks added later (i.e. through the Vagrantfile) also are made non-public, add the following to your Vagrantfile:

# Ensure that all networks are set to private = true

Additional WinRM 1.1 Configuration

These additional configuration steps are specific to Windows Server 2008 (WinRM 1.1). For Windows Server 2008 R2, Windows 7 and later versions of Windows you can ignore this section.

  1. Ensure the Windows PowerShell feature is installed
  2. Change the default WinRM port (see below) or upgrade to WinRM 2.0.
netsh firewall add portopening TCP 5985 "Port 5985"
winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}

Required Windows Services

If you like to turn off optional Windows services you'll need to ensure you leave these services enabled for vagrant-windows to continue to work:

  • Base Filtering Engine
  • Remote Procedure Call (RPC)
  • DCOM Server Process Launcher
  • RPC Endpoint Mapper
  • Windows Firewall
  • Windows Remote Management (WS-Management)

The Vagrant File

Add the following to your Vagrantfile

config.vm.guest = :windows :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true

Example: ```ruby Vagrant.configure("2") do |config|

# Configure base box parameters = "vagrant-windows2008r2" config.vm.box_url = "./" config.vm.guest = :windows

# Port forward WinRM and RDP :forwardedport, guest: 3389, host: 3389 :forwardedport, guest: 5985, host: 5985, id: "winrm", auto_correct: true

end ````

Available Config Parameters:

    - How long Vagrant should wait for the guest to shutdown before forcing exit, defaults to 30 seconds
    - How often Vagrant should check if the system has shutdown, defaults to 1 second
    - Force network adapters to "Work Network". Useful for Win7 guests using private networking.
  • config.winrm.username
    - The Windows guest admin user name, defaults to vagrant.
  • config.winrm.password
    - The above's password, defaults to vagrant.
    - The IP of the guest, but because we use NAT with port forwarding this defaults to localhost.
  • config.winrm.guest_port
    - The guest's WinRM port, defaults to 5985.
  • config.winrm.port
    - The WinRM port on the host, defaults to 5985. You might need to change this if your hosts is also Windows.
  • config.winrm.max_tries
    - The number of retries to connect to WinRM, defaults to 20.
  • config.winrm.timeout
    - The max number of seconds to wait for a WinRM response, defaults to 1800 seconds.

Note - You need to ensure you specify a and a config.winrm in your Vagrantfile. Currently there's a problem where Vagrant will not load the plugin config even with defaults if at least one of its values doesn't exist in the Vagrantfile.

What Works?

  • vagrant up|halt|reload|provision
  • Chef Vagrant Provisioner
  • Puppet Vagrant Provisioner
  • Shell Vagrant provisioner. Batch files or PowerShell (ps1) scripts are supported as well as inline scripts.


When I run the winrm command I get: "Error: Invalid use of command line. Type "winrm -?" for help."

  • You're running the winrm command from powershell. You need to put
    etc in single quotes:
    winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'

I get a 401 auth error from WinRM

  • Ensure you've followed the WinRM configuration instructions above.
  • Ensure you can manually login using the specified config.winrm.username you've specified in your Vagrantfile.
  • Ensure your password hasn't expired.
  • Ensure your password doesn't need to be changed because of policy.

I get a non-401 error from WinRM waiting for the VM to boot

  • Ensure you've properly setup port forwarding of WinRM
  • Make sure your VM can boot manually through VBox.

SQL Server cookbook fails to install through Vagrant

  • Ensure UAC is turned off
  • Ensure your vagrant user is an admin on the guest
  • The SQL Server installer uses a lot of resources, ensure WinRM Quota Management is properly configured to give it enough resources.
  • See COOK-1172 and for more information.

If all else fails try running vagrant with debug logging, perhaps that will give you enough insight to fix the problem or file an issue.


  1. Fork it.
  2. Create a branch (git checkout -b myfeaturebranch)
  3. Commit your changes (git commit -am "Added a sweet feature")
  4. Push to the branch (git push origin myfeaturebranch)
  5. Create a pull requst from your branch into master (Please be sure to provide enough detail for us to cipher what this change is doing)


Clone this repository and use Bundler to get the dependencies:

$ bundle install

Once you have the dependencies, you can run the tests with

$ bundle exec rake spec

If those pass, you're ready to start developing the plugin. You can test the plugin without installing it into your Vagrant environment by just creating a Vagrantfile in the top level of this directory (it is gitignored) that uses it, and use bundler to execute Vagrant:

$ bundle exec vagrant up

Installing Vagrant-Windows From Source

If you want to globally install your locally built plugin from source, use the following method (this would be for 1.2.0):

 bundle install
 bundle exec rake build
 vagrant plugin install pkg/vagrant-windows-1.2.0.gem

Keep in mind you should have Ruby 1.9.3 and Ruby DevKit installed. Check out the following gist that can get you what you need (from blank system to fully ready): Install Vagrant Windows Plugin From Source Gist.

References and Shout Outs

  • Chris McClimans - Vagrant Branch (
  • Dan Wanek - WinRM GEM (
    • +1 For being super responsive to pull requests.
  • Mike Griffen - Added first vagrant-windows unit tests and updated readme
  • Geronimo Orozco - Shell provisioner support
  • David Cournapeau - Added option
  • keiths-osc - Fixed Vagrant 1.2 shared folder action
  • Rob Reynolds - Updated readme installation and box configuration notes
  • stonith - Updated readme winrm config notes
  • wenns - Updated readme to advise against forwarding RDP
  • Joe Fitzgerald - Added VMWare support and improved retry logic.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.