Page 1 of 1

[Resolved] The Best Way To Auto Run VMs on Host Start Up

PostPosted: 5. Dec 2018, 05:11
by jrtibayan
Hi all. I've just joined the forum and kinda need a little help.
I have these VMs and would like to run them every time the computer reboots.
What would be the best way to do this on Windows Server 2016?
Below are other conditions that needs to be met.
1. must run vms on startup
2. must run even when not logged on
3. when I do log on and open virtualbox the VM that are running should show that they are running.

Right now I have met condition 1 and 2 by using the method below
create a .cmd file that starts the vms
use task manager to run that file on startup even if not logged on

The problem with the solution I'm using above is it does not meet condition number 3.
When I log in and open Virtualbox. The VMs are not running but I know that they are since I can access them using Remote Desktop.

It would be great if you guys can help me with this. Maybe there's a preferred method to do this kind of thing.
Thanks a lot in advance.

Re: The Best Way To Auto Run VMs on Host Start Up

PostPosted: 5. Dec 2018, 14:18
by socratis
There's a single, simple rule to remember: each VM runs in the context of the user that registered/launched it, it's not shareable.

So, when you use the Task Scheduler to start the VM, that VM runs in the context of the System user, not your specific user.

The best way to communicate/control the VM would be to enable VRDP on the VM and use your favorite RDP client to connect to it.

Re: The Best Way To Auto Run VMs on Host Start Up

PostPosted: 5. Dec 2018, 16:55
by Rootman
Years ago I messed around doing this. I took far too long in trying to do it 'right' and found the simplest solution was to enable autologon for the user I used, put shortcuts for the VMs into the the users Startup folder and then also put a shortcut to lock the server in the startup folder too.

So it boots, begins to start the VMs and locks immediately. I suppose there is a few seconds it's logged in and open, although you'd be hard pressed to try and catch it to do anything.

I created a shortcut to the following and placed it into the startup folder to lock the station.
C:\Windows\System32\rundll32.exe
Args:
user32.dll,LockWorkStation

Re: The Best Way To Auto Run VMs on Host Start Up

PostPosted: 6. Dec 2018, 02:46
by jrtibayan
Haha! I feel silly forgetting something so simple.
I already considered having it login automatically but was hesitant because other people may use it.
I forgot I can just lock it again after running the VMs.
PROBLEM SOLVED! :)

Thank you so much Rootman