Does anyone have a reliable method to start up a VM on boot/reboot of a Windows machine hosting a VM (which runs my HA instance)?
I have a reasonably reliable method. I use a “.BAT” file in the startup folder containing:
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm hass.io --type headless
However, you can set it up to run as a service too (see here).
When I originally set this up I also ensured something else was turned on, but I can’t remember what - it might have been Fast Startup or Fast User Switching (and Googling hasn’t helped). Whatever it was, it has the effect of logging you on automatically, but leaving you at the logon screen. This means the script runs even if you don’t actually logon.
The only time it doesn’t work for me is when somebody else also logs into the PC with a different account. If a reboot happens then, it does the “pre-logon logon” for them, not the account I want.
@michaelblight thank you - I set up the BAT method and it seems to work fine - thanks!
You could possibly use Sysinternals Autologon from Microsoft to improve reliability of the login after a reboot.
Is this .bat file placed in the startup folder or only shortcut to the file?
I’m using VBoxVmService (https://github.com/onlyfang/VBoxVmService) it enable to run or shutdown VirtualBox Virtual Machines without a user being logged.
Here is an aternative if you are not able to work with the startup folder.
It did not work for me beacause Windows is not able to open my session, probably due to Windows Hello.
Note: i’m runing Windows 10 Pro version : 21H2.
Step 1 : make a .bat file with the content, like :
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm YourVMName --type headless
and save it where ever you want
Step 2 : make a windows task scheduler that start at startup and run your script.
Open “computer management”, by right clicking on the start Windows button.
step 3 : set all parameters :
Triggers : at startup
Action : start a program : … path to your .bat file
Then try it !