1

I can see that I can start and stop a vm with virtualBox using VBoxManage. I m not sure this is the tool I need.

I m trying to write a script that

  1. Will boot the VM (different flavours of Windows)
  2. Run a custom piece of software (in my case an installer) and record the results of this
  3. power of the VM

I am aware of the existence of the web services and the API, however I couldnt find much online about point 2.

I would really appreciate some direction on this. ie should I use vboxmanage to start and stop the VMs and then run the installers in some other way? alternatively should I use the COM API, if so, any ideas of some samples on how to do step 2?

Not familiar with VirtualBox at all. But I can write code.

UPDATE: Should I be looking at Vagrant or Puppet? As you can probably guess this is a test suite for installers, and it would be great to be able to re use it.

Thanks

Miau
  • 133
  • 1
  • 7
  • Why the minus one? – Miau May 10 '12 at 19:01
  • To tell you are using Windows, I had to read until I saw 'COM API'. Perhaps that has something to do with it... –  May 10 '12 at 19:32
  • The -1 is probably because you are asking about VirtualBox, a tool which is frowned upon in a server environment. – Bart De Vos May 10 '12 at 20:19
  • 1
    Doesn't sound like a server environment. It sounds like: `As you can probably guess this is a test suite for installers` –  May 10 '12 at 21:01
  • Hi Bart De Vos: I m all up for learning, I m trying to find a good way to test installers in the platforms I need to target. Why is VB frowned upon? oracle? Also, I d love to hear options. Cheers – Miau May 11 '12 at 10:42

2 Answers2

4

You can start a VM with

VBoxManage startvm <vm>

and power it down with

VBoxManage controlvm <vm> poweroff 

although it would be better to use acpipowerbutton:

VBoxManage controlvm <vm> acpipowerbutton

You can execute commands on the Guest using

VBoxManage guestcontrol execute ...

this works fine for command line programs and you can redirect the output to your host. However, I'm not sure how well this works with GUI applications like a normal Windows MSI installer package. Also the bit about 'recording the results' is a bit vague, does your installer write a log file that you could send to a network share before powering down the VM?

You can also take a snapshot of the VM and then look at it later

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Peter Hahndorf
  • 13,763
  • 3
  • 37
  • 58
  • exec definetly execs tho the installer needs to be able to support running from the cmd, this is a diff problem altogether. Thanks – Miau May 11 '12 at 12:05
1

Yes, it is possible to script exactly what you describe. Allegedly it's possible to do this from a Windows host environment, but in my experience, these capabilities work fully only in Linux. (The scripting works fine in OS X too, but you can't get RDP authentication, which makes scripting in a remote system less of an interesting process.)

With the addition of some various hoop-jumping, you can also update the guest additions remotely, install/remove software, run Powershell scripts, and use WUInstall to update Windows. It's really pretty slick.

Eric

ericjray
  • 11
  • 1