Use VBoxManage list ostypes In order to get the possible OS types you can use. Also note that 64bit OS may not show up on this list if Virtualization Technology (Intel VT-x, AMD-V, etc) is not enabled in the BIOS.

Vagrant Up

Edit Vagrantfile
By default winrm is not setup (ssh is the default); you need to explicitly set it. In addition, I didn’t use the default vagrant user/password, so I set those as well. Lastly make sure to forward the RDP port.

* In Vagrant version 1.6.3 there was a regression introduced around the rdp command (See issue #3973). I used my regular Remote Desktop client manually and all worked fine.

At this point you should have a Windows Box all set with Vagrant. In a future post, I intend to discuss provisioning software with Chef. If you ran into any issues following these instructions, please add those as comments below. Thanks for reading!

Post navigation

29 thoughts on “Creating a Windows Box with Vagrant 1.6”

Hi Denny,
I’ve done eveything you said, works fine with a win2k12 server but it isn’t working with a w2k8. When I “Vagrant Up”, it blocks at “waiting for machine to boot..” and then tells me thar i’ve got a networking problem. Any Idea ? Thanks a lot for the Tutorial btw 🙂

I ran into similar problems when using w2k8 since it doesn’t have winrm configured by default and also had to allow the traffic through the firewall (see steps 1-4 on the “Configure WinRM & RDP” section above)

I think I missed something when I read the tutorial for the first time because now it’s perfectly working. Thank you ! Have you made attempts to use External Script provisionning ? The script I created in order to install software on the guest machine starts in background mode. I wonder if there is a configuration in WinRM to change.

Hey Denny. Thanks for this. I had run into that RDP regression issue you mentioned, even reported it to them when I found it. I’m curious if you have blogged more about the provisioning side of things yet. I didn’t see anything when I did a quick glance around your site.

While Chef would be interesting, I’m hoping that just using PowerShell will be sufficient. Trying to reduce the learning curve for other developers.

Glad to hear that. I made some pretty good progress with PS provisioning last week. Have a base box that now runs scripts to install .NET 4.5, Remote Debugging and added the Web Server Role. Currently working on/testing installation of SQL 2008 R2 Express. Looking forward to your post.

Thanks Denny! I’ll have to read that other article. I had made decent progress getting through multiple installations via PS (including SQL Express 2008 R2) but was pulled onto other tasks and haven’t had a chance to get back to playing with this. I hope that changes soon, have some big ideas that I want to get working.

Great article! I am just trying to explore Vagrant and I have a doubt. Will I be able to open multiple instances of a single image using vagrant command line [bundled with virtual box]? If so any commands list that I need to be familiar with?

HI Venkat, looks like you’ve got an answer from stackoverflow already. I’d recommend to update Vagrant to 1.6.5 if you’re still running into issues with RDP. On another note you can add this to your Vagrantfile to disable headless mode and get a GUI when you execute vagrant up

Hi Denny,
I did get answers but they didn’t seem to help me out completely. I upgraded to Vagrant 1.7.1 and followed all your steps until vagrant up where I got an error. My vagrantFile is as follows:
Vagrant.configure(2) do |config|
config.vm.box = “serverbasebox”
config.vm.communicator = “winrm”
config.vm.username = “Administrator”
config.vm.password = “password123”
config.vm.network “forwarded_port”, guest: 33389, host: 3389
end

I get the following error:
Bringing machine ‘default’ up with ‘virtualbox’ provider…
There are errors in the configuration of this machine. Please fix
the following errors and try again:

Interestingly, then I had the “Forwarded port ‘xxxx’ (host port) is declared multiple times” error. Despite this is not the case in my Vagrantfile, several port forwardings seem to be hardcoded in the source of Vagrant that under uncertain circumstances take effect. But I worked around that using labels as mentioned in the comments to this bug report: https://github.com/mitchellh/vagrant/issues/1541#issuecomment-17315713

Now that worked it out. Now I just have port conflicts with the host network to resolve but that’s no explicit Vagrant issue and I should be able to work that out eventually 🙂

Update: I have found by googling that there was a Change in newer RDP Client of Windows that ports 3389 and 3390 shall no longer be used but port 3388 worked.
The only issue I have now is that after “vagrant up” the vagrant procces hangs at “Waiting for machine to boot.This may take a few mins…” Any idea why that happens and how to avoid it? It’s not a biggie, as I can cancel it with CTRL and C and then run vagrant Provision but would be cool to have it working 100%. I have put my vagrantfile up at for you to loook at:https://mega.co.nz/#!pgJHVRRb!XV3oTIiJPkZD-8_PuZONBQWdcumkHHP6NQ7ngTte9jk

[…] The focus of this article is on provisioning. However I’m including a summary of steps taken to create a WS2012 Virtual Box using Packer (For information on manually creating Vagrant Windows Boxes see my previous post) […]

Great to hear that Joerg 🙂 Would you mind posting your solution? I did get a brief chance to look at your Vagrantfile but didn’t really spot any issues there. Thought that the issue might be with the configuration on the base VM.

However, when I run vagrant up, it hangs and eventually times out on this:

==> default: Waiting for machine to boot. This may take a few minutes…

Even though the machine boots up fine. There seems to be an issue with connecting to it.

I end up getting this message:
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured (“config.vm.boot_timeout” value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout (“config.vm.boot_timeout”) value.

If your box is timing out when you Vagrant up, it’s almost always either a problem with your connector (ssh, winrm, etc), with the virtual network setup itself (the first nic MUST be NAT for Vagrant to work) or with your (guest machine) firewall.