Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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... –  AlexWebr May 10 '12 at 19:32
    
Thanks AlexWebr :D –  Miau May 10 '12 at 19:37
    
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 –  AlexWebr May 10 '12 at 21:01

2 Answers 2

up vote 2 down vote accepted

You can start a VM with

VBoxManage startvm <vm>

and power it down with

VBoxManage controlvm <vm> poweroff 

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

share|improve this answer
    
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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.