Before I start I should put forward that since Oracle VM VirtualBox brought autostart-as-a-service support to Windows the correct way to do this is covered in the official documentation: 9.21.4. Windows: Starting the Autostart Service.
Even before that, more sophisticated and ideologically correct ways to do this were devised in the wider community out of necessity:
- Use Task Scheduler
- Create a .bat Batch File that calls VBoxManage with the --type headless argument
- Improve on the batch file by calling VBoxHeadless.exe from a VisualBasic Script without the need of a GUI (then presumably add it to:)
(Current User) HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run (All Users) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run
But as I retire (thank god) an old Windows VirtualBox server I had to rush many moons ago I am inclined to record this hot tip straight out of the Windows 95 era for posterity. See, back in my day savvy Power Users started their applications by dropping shortcuts in the Start Menu > Startup folder - and while it's not obvious on modern versions of Windows this directory (in fact several of them, scattered in the various locations that are merged into the actively displayed Start Menu) is still alive and kickin'. This method depends on your VirtualBox VM administrator account automatically logging in - i.e.: passwordless. Because if you're going to half-ass a server go all the goddamned way.
- In the VirtualBox Manager GUI right-click on the desired virtual machine(s) and select Create Shortcut on Desktop
- Open the Run prompt by pressing Meta (Windows) Key + R and entering shell:startup or open an instance of File Explorer and in the address bar type %appdata%\Microsoft\Windows\Start Menu to zip to C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
- Cut the VM shortcuts from your desktop and paste them into your Statup folder
- Crack a beer and land those puppies up on the desk: you are MCSE Material(tm).