Hi Clement, would suggest to verify you can manage your guest vm with winrm outside of vagrant. One way to do this is to install chef’s knife utility and execute the following command:knife winrm ‘node1.domain.com’ ‘dir’ -m -x domainadministrator -P ‘supersecretpassword’ –p 5986This is documented on the knife windows site: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). 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 “forwardedport”, guest: 33389, host: 3389endI get the following error:Bringing machine ‘default’ up with ‘virtualbox’ providerThere are errors in the configuration of this machine. Please fixthe following errors and try again:vm:. The following settings shouldn’t exist: password, usernameAny suggestions as to what I can do about this?.
Hi Denny, thanks for your speedy and detailed reply.I have worked around the issue by configurating the RDP and SSH like described in the blog article here: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: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:Thanks in advance!. Hi Denny,I followed all your steps on setting up WinRM my Windows 7 VM and I edited my Vagrantfile as follows:config.vm.box = “win7v4”config.vm.communicator = “winrm”config.winrm.username = “Administrator”config.winrm.password = “mypassword”config.vm.network:forwardedport, guest: 33389, host: 3389, id: “rdp”, autocorrect:trueconfig.vm.network:forwardedport, guest: 5985, host: 5985, id: “winrm”, autocorrect:trueconfig.windows.setworknetwork = trueHowever, when I run vagrant up, it hangs and eventually times out on this: default: Waiting for machine to boot.
This may take a few minutesEven 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 thatVagrant was unable to communicate with the guest machine withinthe configured (“config.vm.boottimeout” value) time period.If you look above, you should be able to see the error(s) thatVagrant had when attempting to connect to the machine.
These errorsare usually good hints as to what may be wrong.If you’re using a custom box, make sure that networking is properlyworking and you’re able to connect to the machine. It is a commonproblem 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 increasethe timeout (“config.vm.boottimeout”) value.Any ideas what might be wrong?
May 24 Using Packer, Vagrant and Boxstarter to create Windows environmentsTesting your application in different environments can be hard to do manually, as its time consuming, error prone, and not easily reproducible. This article will show you a way on how to automatically create Windows environments, where you can test your application. ToolsYou will use the following tools:. and to create an up-to-date Windows base image from an ISO file. to launch and configure a base image tailored to a specific scenario.
to easily install software from packages. to run virtual machines.InstallYou will need to run several commands.
These must be run on a bash shell, which I’ll assume that you have installed following the instructions from.Make sure you have previously installed Packer, Vagrant and VirtualBox and have them available on your PATH, e.g. Export PATH = '$PATH:/c/Development/packer' export PATH = '$PATH:/c/Development/Vagrant/bin' export PATH = '$PATH:/c/Program Files/Oracle/VirtualBox' Windows base imagePacker is a tool to automatically create a machine image from a.packer-windows is a repository with pre-configured template files for installing different Windows versions.We will use them to drive the installation of Windows 2012 R2 into a virtual machine image. This image will have the bare minimum needed to be later used by Vagrant.This base image will be automatically configured with:. SSH server. vagrant user account with a vagrant password. Latest Windows updates. VirtualBox guest additions.
60 GB disk.Start by getting the Windows template files. Mkdir testing && cd testing cat Vagrantfile # -.- mode: ruby -.- # vi: set ft=ruby: Vagrant.
Requireversion '= 1.6.2' Vagrant. Configure ( '2' ) do config config. Define 'testing' config. Box = 'windows2012r2' config. Provider:virtualbox do v, override v.
Gui = true v. Customize 'modifyvm',:id, '-memory', 2048 v. Customize 'modifyvm',:id, '-cpus', 2 end end EOFAnd launch it: time vagrant upNB The initial run will take about 4m to boot into Windows.
Later runs take about 40s. But YMMV.NB To troubleshoot you need pass the -debug flag to vagrant up.Once Windows boots, try it a bit to check whether things are working fine, and then stop the virtual machine with: vagrant haltAnd destroy it: vagrant destroyYou are now ready to customize a vagrant environment to fit your needs. For that we will modify the Vagrantfile to use a provision script. ProvisioningCustomizing a vagrant environment is a mater of creating one or more provision scripts. Lets start simple, with one embedded within the Vagrantfile, it will just change the keyboard layout and timezone. Cat Vagrantfile # -.- mode: ruby -.- # vi: set ft=ruby: Vagrant.
Requireversion '= 1.6.2' # NB this is a PowerShell script that is run as Administrator. $rootprovisionscript =. Vim Vagrantfile. $rootprovisionscript =.
Catsetup.ps1# NB this file has to be idempotent. It will be run several times if the computer needs to be restarted.
# when that happens, Boxstarter schedules this script to run again with an auto-logon. # NB always remember to pass -y to choco install! # NB already installed packages will refuse to install again; so we are safe to run this entire script again. Md5sum d:/Images/windows2012r2.iso458ff91f8abc21b75cb544744bf92e6a.d:/Images/windows2012r2.isoIf you don’t have a volume license ISO, you also need to set the Product Key. For that open the answerfiles/2012r2/Autounattend.xml file, search for ProductKey and follow the instructions.
The EndAnd thats it! You should now be able to create Windows environments to fit your needs.You should also look into configuration management tools like,. These might useful to actually install and configure your own application.