Running applications withing a VM from a host command-line

This is for discussing general topics about how to use VirtualBox.
Post Reply
oloth
Posts: 8
Joined: 10. Nov 2009, 20:13
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: XP, Linux (Ubuntu), FreeBSD

Running applications withing a VM from a host command-line

Post by oloth »

In short, can I run an application from within a guest, just by specifying command line parameters to a vmanage from the host?

My clients send me a lot of untrusted applications that's why I use a persistent VM to run those, and that makes a it a lot of clicking within the VM.
Is there a possibility to execute applications inside the VM by running a shell script from the HOST?

Thank you in advance.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Running applications withing a VM from a host command-line

Post by stefan.becker »

VBoxManage guestcontrol execute Guest Command

For the exact syntax read User Manual.
oloth
Posts: 8
Joined: 10. Nov 2009, 20:13
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: XP, Linux (Ubuntu), FreeBSD

Re: Running applications withing a VM from a host command-line

Post by oloth »

thanks a lot
I appreciate it
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

Re: Running applications withing a VM from a host command-line

Post by HubTou »

Hello,
stefan.becker wrote:VBoxManage guestcontrol execute Guest Command
It's also possible to do it with "VBoxManage controlvm <uuid>|<name> keyboardputscancode <hex> [<hex> ...]".

On the minus side:
- You don't get any feedback on the command output (unless you redirect it somewhere (for example with output redirection, "tee" or "script" on Unix guests) and use other commands to analyse it)

On the plus side:
- It works without Guest Additions (GA)
- It always work, even when you're installing the OS inside the guest (too early to have GA inside)
- It's not limited to actions on commands (for example, you can send events to GUI apps)

You'll find a small shell library to ease the use of scancodes and a whole example in which an host controls the installation and configuration of an OS in a Guest there:
http://www.projet-hev.org/dist/generateur1.tar.bz2

Best regards,

Hubert
oloth
Posts: 8
Joined: 10. Nov 2009, 20:13
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: XP, Linux (Ubuntu), FreeBSD

Re: Running applications withing a VM from a host command-line

Post by oloth »

Thank you for the additional info,
that's really works for me,
Thanks
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

Re: Running applications withing a VM from a host command-line

Post by HubTou »

Hello,

Here's a little video capture of my generator running in debug mode plus VNC display (both are not needed):
http://www.projet-hev.org/dist/hev1.flv

The OS is installed twice (the first time in a small 1GB swap-less rescue partition, the second time in the main partition) and with very little configuration (because there's a second generator which takes care of that). The disk geometry and the partitions sizes are input parameters...

Best regards,

Hubert
Post Reply