VirtualBox as a Service on SBS 2008

This post is in regards to setting up VirtualBox to run as a service on Microsoft Small Business Server 2008 x64. This would also probably work on Windows Server 2008, Windows 7, and a number of other Microsoft Windows operating systems.  Other tutorials exist (and work) for most OS’s before Vista.

For whatever reason, Sun decided that VirtualBox should not natively run as a service.  If you’ve found this article through search engines because you couldn’t find a way to enable it, (which is why you looked on google in the first place), now you know.  If you weren’t aware of this limitation, sorry, I know it sucks.  Even the current version (as of Feb 2010) doesn’t support this function. The good news is that there’s a dirty hack you can use to get around this.  First and foremost, if you haven’t already considered VMware Server instead, you might.  It’s free, and handles the starting and stopping of virtual machines as background tasks so much better.  But honestly, VirtualBox is a much cleaner application and I much prefer it.

So, onto the nitty gritty.  After six hours of trial and error with other tutorials, I found the solution in this post:

By using and instructions from page 12 of the forum posts, I found a solution that worked.

General HOWTO for what ended up being the solution:

  1. Download and install VirtualBox from
    • In VirtualBox preferences, I have both my default Hard Disk and Machine folder set to D:\vm\VirtualBox\
      • You can do whatever you want on your own system, as long you have an organizational system.  The default path is in your user directory, which I don’t like.
      • The VirtualBox configuration is in C:\Users\[YOU]\.VirtualBox\, which you’ll need later.
  2. Download or build a virtual machine.
    • If you want to make more than one, make sure the configuration settings in VirtualBox are as desired for all of them.  Changing them later requires you to repeat a few steps from this process.
    • I suggest keeping your VM names simple, without spaces.
  3. Make sure that your VMs are fully configured to be accessed remotely, and then shut down VirtualBox.  This is important.
  4. Download VBoxVmService from
    • I extracted the files to D:\vm\vms on my system.
    • View the README from the doc folder, and make sure you have the prerequisites for installation.
  5. Complete the VMS configuration:
    • Edit the paths in the VBoxVmService.ini file.  Make sure everything matches up to where you decide to place files.  Here’s mine:
    • [Settings] ServiceName=VBoxVmService PathToVBoxSDL=C:\Program Files\Sun\VirtualBox\VBoxSDL.exe PathToVBoxHeadless=C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe PathToVBoxManage=C:\Program Files\Sun\VirtualBox\VBoxManage.exe VBOX_USER_HOME=C:\Windows\System32\config\systemprofile\.VirtualBox\ [Vm0] VmName=Joomla CommandLineUp=D:\vm\vms\startup.exe 0 BRUTEFORCE CommandLineDown=D:\vm\vms\shutdown.exe 0 WorkingDir=D:\vm\vms\ StartupMethod=vrdp ShutdownMethod=savestate VrdpPort=3001 [Vm1] VmName=WindowsXP CommandLineUp=D:\vm\vms\startup.exe 1 BRUTEFORCE CommandLineDown=D:\vm\vms\shutdown.exe 1 WorkingDir=D:\vm\vms\ StartupMethod=vrdp ShutdownMethod=savestate VrdpPort=3389
    • In a command prompt, CD to the installation program and register VBoxVmService as a Windows Service with the command:  VBoxVmService.exe –i
  6. This step was required for me, but there are probably ways around it.  The official instructions say you’re done here and ready to start the VBoxVmService through Windows.  If it doesn’t work, do the following:
    • COPY the master .VirtualBox folder from my /Users directory to a location of my choice, as defined by VBOX_USER_HOME in the VBoxVmService.ini file.
      • I chose to use C:\Windows\System32\config\systemprofile\

That actually should be it.  Check your logfiles in the vms folder and the machine folders to make sure that the virtual machines are running properly.

Not only will this automate the bootup process of your VirtualBox VMs, but supposedly it also performs a clean shutdown of them as well.  One unfortunate oversight that may be unavoidable is that VMs which either have crashed or powered down may be impossible to restart individually without either restarting the entire service (and presumably all the VMs) or creating a separate service for each VM.  Either way, the implementation is less elegant than VMware Server.  But it seems to work, and things have been stable.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s