Oracle’s VirtualBox software comes with a wide range of command line tools that allow you to manage the VirtualBox virtual machines. One of these tools is “VBoxHeadless.exe”.
This tool allows you to start up a virtual machine from the command line, without having to load the Virtualbox application itself. This is great for when the virtual machine you want to run is a server, and you want to only connect into it using SSH or RDP, instead of using the console provided with VirtualBox.
The two main command line parameters for VBoxHeadless.exe are the -s and -v parameters:
-s = start the specified virtual machine, using either its name, or its unique id.
-v = Enable the VirtualBox RDP server to allow a connection to the VM’s console.
For example, to start the virtual machine called “Debian” you would issue the following command:
"C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" -s "Debian" -v on >nul 2>&1
I have chosen to output all screen data to “nul” (read NULL), so that it doesn’t display in the command prompt window.
This is what it should look like:
You can set up a batch file, or some sort of login script, so that the virtual machine can start when you log into Windows.
The only issue with this method, is that the command prompt window remains open. There are 3rd party tools/applications available to assist in running a headless virtualbox virtual machine, however they essentially use the VBoxHeadless.exe command in the background.
Run “VBoxHeadless.exe” without any command line parameters to see a list of all the available options.