Vagrant doesn't execute shell script

106 views
Skip to first unread message

Maxsa Sidorov

unread,
Mar 20, 2016, 1:43:53 PM3/20/16
to Vagrant
Hi.
I want learn vagrnat.
My goal: create Windows 7 and execute batch file wich create "Hello World" folder.

My Vagrantfile :

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!

Vagrant.require_version ">= 1.6"

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # Configure base box parameters

  # Windows XP, Windows 7, Windows 8 with IE.
  # List of the boxes is next:
  # vagrant-xp-ie6
  # vagrant-xp-ie8
  # vagrant-vista-ie7
  # vagrant-win7-ie8
  # vagrant-win7-ie9
  # vagrant-win7-ie10
  # vagrant-win7-ie11
  # vagrant-win8-ie10
  config.vm.box = "vagrant-windows7-enterprise"
  config.vm.box_url = "http://aka.ms/vagrant-win7-ie10"

  config.vm.communicator = "winrm"

  # default passwords for boxes with IE
  config.winrm.username = "IEUser"
  config.winrm.password = "Passw0rd!"

  # Port forward WinRM and RDP
  config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
  config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true

  # This shell provisioner installs chocolatey and puppet. Also runs librarian-puppet.
  config.vm.provision :shell, :path => "boostrap.cmd"

  # use this if you want GUI running
  config.vm.provider "virtualbox" do |vm|
        vm.gui = true
  end
end

 boostrap.cmd has following content:

mkdir c:\\HelloWorld

But when vagrant create VM, I doesn't see any folder. I think this batch file didn't execute. How can Ii fix it?

Maxsa Sidorov

unread,
Mar 20, 2016, 4:07:01 PM3/20/16
to Vagrant
Update.
I wait and see error:
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.

Maxsa Sidorov

unread,
Mar 21, 2016, 2:35:54 AM3/21/16
to Vagrant
Does have any idea?
Maybe it's wring configure VM?
I tryed connect telnet to 5985 by this machine didn't response.

pixel fairy

unread,
Mar 21, 2016, 7:26:19 PM3/21/16
to Vagrant
looks like you called boostrap.cmd

did you mean bootstrap.cmd?

to use the modern ie vagrant boxes you have do some additional setup

https://gist.github.com/andreptb/57e388df5e881937e62a

you might want to make your own with packer or ask the modern ie team to include winrm in theirs.

Maxsa Sidorov

unread,
Mar 23, 2016, 10:33:02 AM3/23/16
to Vagrant
Hi.
No I didn't mean bootstrap.cmd.
Actually your advice didn't  help.
When I enabled winrm in VM and create box, I tried vagrant up with modification box.
But in box Winrm was disabled. So it's didn't work for me.
Maybe I should use old version of vagrant and virtual box?

Alvaro Miranda Aguilera

unread,
Mar 24, 2016, 12:52:57 AM3/24/16
to vagra...@googlegroups.com
Hello,

Can you share more information?

ie. the vagrantfile you are using.

winrm usually should be properly configured in Vagrantfile included int he box,\\it doesn't then you can workaround it on the project Vagrantfile, but thats just a workaround

What boxes have you tried? are you building your own box?

The minimum starting point is share your Vagrantfile and what messages you get on vagrant up
then, what is not working what should be working, and what you have tried,

otherwise, is very hard help.

Thanks
Alvaro.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/d7984c99-8386-4b99-a173-91f6aa5012bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages