Saturday, April 11, 2020

Autostart VirtualBox

VirtualBox can be set to start automatically when windows boot up and run hidden in background. Follow the following steps to make it autorun :
1. Go to VirtualBox installation directory and right click VBoxManage.exe then "choose send to desktop"

2. Go to desktop and right click the vboxmanager schortcut that was created before, then choose properties.

3. Copy and paste the command below to the target box :

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "MikroTik-RouterOS-6.40.1" --type headless
Note:
- C:\Program Files\Oracle\VirtualBox = change it to virtualbox directory.
- "MikroTik-RouterOS-6.40.1 = change it to your VM name. You can find it in Setting - General - Name


 4. Push windows and R button together, then type : shell:startup.

5. Copy and paste the VBoxManage shorcut to the startup folder.

6. You can make a shortcut to shutdown the virtual machine without shutdown the host machine. Create a shorcut then paste this command to the target box :
 "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "MikroTik-RouterOS-6.40.1" poweroff soft

7. If you don't want the virtual machine to run hidden, just make a shorcut of the virtual machine from VirtualBox main windows and copy the shorcut to startup folder.

8. If you want the virtual machine to run without log-in or sign-in to windows, make a batch file and copy  command from virtual machine shorcut target box you have created before to the batch file . Make a task scheduler for the batch file, then in General tab properties of the scheduler choose  "Run whether user is logged on or not" and check "Do not store password" and "Run with highest privileges", then change "Configure for" to Windows 10 if  you run it on Windows 10. Then go to Triggers tab and click edit, then change "Begin the task" to "At startup".

@echo off
start "" "C:\Program Files\Oracle\VirtualBox\VirtualBoxVM.exe" --comment "MikroTik-RouterOS-6.40.1" --startvm "{d5968ac9-0b52-49ea-8b7c-0d07df2eae77}"
exit

No comments:

Post a Comment