Run VirtualBox as a Windows Service with AlwaysUp

How to Run a VirtualBox Virtual Machine as a Windows Service with AlwaysUp

Ensure that your VirtualBox VM starts immediately when your PC boots and is available 24/7. No login necessary!

VirtualBox is a free, open-source virtualization platform that can host Windows, Linux, Mac OS and other operating systems.

To run your VirtualBox VM with AlwaysUp:

  1. Download and install VirtualBox if necessary.

    Create a virtual machine (VM) and ensure that everything works as you expect.

    Be sure to install the VirtualBox extension pack if you intend to use VirtualBox's Remote Display feature to connect to your VM.

  2. Download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. On the General tab:

    • In the Application field, enter the full path to the VBoxHeadless.exe application, which allows you to start a VM without a graphical interface.

      If you installed VirtualBox in the default location, this is:

      C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe

    • In the Arguments field, enter:

      -startvm "<VIRTUAL-MACHINE_NAME>"
      where <VIRTUAL-MACHINE_NAME> is the name of the VirtualBox VM you would like to start automatically. We have specified "Windows Server 2022" in this tutorial.

      Note: Instead of starting your VM by name, can launch it using the VM's unique identifier (UUID). To do so, specify parameter -s <UUID> (instead of -startvm), where <UUID> is the identifier for your VM. You can list your VM's UUIDs by running Vboxmanage.exe list vms from the VirtualBox installation folder.

    • In the Start the application field, select Automatically, but shortly after the computer boots.

      This setting — which delays VM startup by about 2 minutes — should ensure that critical system services (like networking and domain authentication) are ready and waiting when your virtual machine is launched in the background.

    • In the Name field, enter the name that you will call this application in AlwaysUp. We have specified "Windows Server 2022 VM" but you can enter virtually anything you like.

    VirtualBox Windows Service: General Tab

  6. Click over to the Logon tab. Enter the user name and password of the account in which you installed and run VirtualBox. AlwaysUp must run your VM must in this account so that it can find its settings:

    VirtualBox Windows Service: Logon Tab

  7. Move to the Startup tab and check the Ensure that the Windows Networking components have started box. This informs AlwaysUp that VirtualBox needs the TCP/IP networking stack to operate.

    VirtualBox Windows Service: Startup Tab

  8. And finally, on the Extras tab, let's ensure that your VM shuts down smoothly when its stopped.

    • Check the Use this special command to stop the application box. Enter the full path to the VBoxManage.exe application along with a few arguments:

      "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm <VIRTUAL-MACHINE-NAME> savestate
      where <VIRTUAL-MACHINE-NAME> is the name of your VM.

      See the VBoxManage.exe command line arguments for stopping a VM if you wish to stop without saving state, etc.

      Note: VirtualBox user Jesse Connor prefers to use ACPI shutdown instead of savestate because his Linux boxes don't seem to recover smoothly from saved states. For the stop command, he specifies:

      "C:\Program Files\Oracle\VirtualBox\Vboxmanage.exe" controlvm <UUID> acpipowerbutton
      where <UUID> is the identifier for his VM.

    • Check the Wait for up to box and enter 30 in the accompanying field. This tells AlwaysUp to wait for up to 30 seconds for VirtualBox to exit properly before forcibly closing it.

    VirtualBox Windows Service: Extras Tab

  9. Click the Save button. In a couple of seconds, your new application will show up in the AlwaysUp window. It's not yet running though:

    VirtualBox Windows Service: Created

  10. To start your VirtualBox VM, choose Application > Start "Windows Server 2022 VM" (your application name will be different though).

    In a few seconds, the entry's state will transition to "Running" and your VM will be chugging away in the background (in the isolated Session 0):

    VirtualBox Windows Service: Running

    At this point, please connect to your VM and ensure that it works as expected.

    For example, if you set up the Remote Display feature, now would be a good time to open an RDP session to your VM.

  11. That's it! Next time your computer boots, your VirtualBox virtual machine will start up immediately, before anyone logs on.

    We encourage you to edit your VirtualBox entry in AlwaysUp and explore the many other settings that may be appropriate for your environment. For example, send an email if VirtualBox stops unexpectedly, boost the priority of the VM process, and much more!

VirtualBox not working properly as a Windows Service?

  • Please ensure that the VirtualBox commands work as expected on your system.

    For example, does this command start your virtual machine?

    C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe -startvm "<VIRTUAL-MACHINE_NAME>"

    VirtualBox Windows Service: Created

    And does this command stop your VM?

    "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm <VIRTUAL-MACHINE-NAME> savestate

    If not, you should adjust your AlwaysUp settings to use alternate commands that work for you. Please get in touch if you need help doing that.

  • Visit the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running VirtualBox as a windows service.

  • From AlwaysUp, select Application > Report Activity > Today... to bring up a HTML report detailing the interaction between AlwaysUp and VirtualBox. The AlwaysUp Event Log Messages page explains the more obscure messages.

  • Consult the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.

  • Contact us and we will be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.1

7.9 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!