Start VirtualBox and VM in windows boot

What worked for me was.

  1. Create a shortcut.
    • Open virtualbox
    • highlight the VM you want to startup
    • click "Machine" -> "Create Shortcut on Desktop"
  2. Add to windows startup
    • Start -> Run
    • type in "shell:startup"
    • copy & paste shortcut in here.

Oracle VirtualBox 6.1.16 supports automatic startup via a windows service without third party scripts or software. These were the steps I followed. Replace my login with yours throughout.

  1. Create config file in C:\Users\Tim\.VirtualBox\autostart.properties:
    # Default policy is to deny starting a VM, the other option is "allow".
    default_policy = deny
    
    # Bob is allowed to start virtual machines but starting them
    # will be delayed for 10 seconds
    Tim = {
        allow = true
        startup_delay = 10
    }
    
    
  2. Add an environment variable for VBOXAUTOSTART_CONFIG and set it to C:\Users\Tim\.VirtualBox\autostart.properties.
  3. Create the autostart service from an administrative Powershell:
    cd "C:\Program Files\Oracle\VirtualBox"
    .\VBoxAutostartSvc.exe install --user=Tim
    .\VBoxManage.exe modifyvm "Peppermint x64" --autostart-enabled on
    
  4. Find the VirtualBox Autostart Service tim@tim-pc service from the Services app.
  5. Ensure the service login is your local login as configured above.
  6. Ensure that automatic startup is enabled.
  7. Start the service.
  8. Check for errors in the Windows Event Viewer app under application logs. Errors descriptions are under the "Details" tab.

I have an example of how to autostart a VirtualBox VM during Windows startup. I'm running Windows 10, but it shouldn't be much different on Windows Server 2016.

The startup folder on my system is:

C:\Users\chriwill\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

In that folder I placed a batch file kubuntu.bat with following content:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm kubuntu --type headless

In my example the VM is named kubuntu. You'll have to change it for your instance.

ADDON:

If you need help finding the startup folder on your windows instance press keys WINDOWS+R and enter shell:startup.

reference: https://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm