VirtualBox : How to automatically start VM in background

By | June 15, 2013

Oracle VirtualBox do not have such feature through the GUI. However, you can use the command line and the task scheduler to do so.

First, you need to grab guest virtual machine ID that you want to be started in background. Open the command prompt, and change directory as followed :

cd C:\Program Files\Oracle\VirtualBox\

Then use this command to list the VMs on your host with their IDs :

VBoxManage list

Now create a batch file with the following :

cd C:\Program Files\Oracle\VirtualBox\
VBoxHeadless -s "UUID"

*UUID is the actual ID of your VM including the quote.

Now open up the Task Scheduler through Administrative Tools and create a new task.

In the General tab, select the following :

– Run whatever user is logged in or not
– Run with highest privileges

In the Trigger tab, at Begin the task, click New and select :

– At startup

In the Action tab, click new and select :

– Start a program as action
– Browse to the batch file you created earlier as for Program/Script

In the Settings tab, uncheck the box :

– Stop if the task if it runs longer than…

You’re now done for the automatic startup! Now we need to do something to graceful shutdown the VM when the computer stop.

cd C:\Program Files\Oracle\VirtualBox\
VBoxManage controlvm "UUID" acpipowerbutton

*If your guest VM is a Linux machine and this command have no effect at all, then make sure ACPI daemon (acpid) is installed and running!