Start VirtualBox VM with GUI on Windows 10 system boot after auto-login

7,225

After a little bit of googling I found the answer to this - it's a combination of two other things which combined give you the outcome you want.

VM's can be started automatically via calling VBoxManage.exe from the correct folder. On my system this is C:\Program Files\Oracle\VirtualBox

So if you call C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm "test" --type gui it'll fire up a VBox VM called test visible to the user, but not full screened. You could call this via a shortcut which is added to startup items, among other ways.

To get it full screened you have two options - either manually editing the config file for the VM. In my case this was test.vbox in the Virtualbox VMs folder, or starting the VM then pressing the host key (defined as rightctrl+F on my setup to get the VM full screened, then close the VM from the menu (Hit right ctrl to get the mouse to allow you to click the menus if you only have a CLI/Haven't installed Guest Additions).

This edits the config file adding this line:

<ExtraDataItem name="GUI/Fullscreen" value="true"/>

In this section:

<ExtraData>
  <ExtraDataItem name="GUI/Fullscreen" value="true"/>
  <ExtraDataItem name="GUI/LastCloseAction" value="PowerOff"/>
  <ExtraDataItem name="GUI/LastNormalWindowPosition" value="2403,227,720,442"/>
</ExtraData>

Once full screened, if the machine is reset/rebooted it should remain full screen. You could try making the config file read only after setting it to full screen. if you don't want users to be able to escape the full screen you'll likely need to disable the host key somehow - I'm unsure exactly how you'd do this - maybe binding it to a key that the user can't access e.g esc

Share:
7,225

Related videos on Youtube

wgengland
Author by

wgengland

Updated on September 18, 2022

Comments

  • wgengland
    wgengland over 1 year

    I am looking for a script to start a VM in VirtualBox at Windows boot in Windows 10 but have it come up with a full-screen GUI. I just need the script. Everything else is working so please don't spend time on off-topic discussions that are not script related.

    I have searched very thoroughly for how to do this and all I can find is how to do a headless VM start. That is for a remote desktop VM access, and I am trying to do this on a stand-alone PC without using remote desktop. Has anyone successfully done this? Everything I have tried using what info and scripts, batch files, etc. has not worked. I have gotten the headless start to work, but again that isn't what I need. There has to be a way, as it is possible to get other shortcuts to work on startup. I haven't been able to get vboxmanage.exe to start a VM automatically at boot. I want this to work after an auto-login. I am trying to present the VM to the user as if it were booting directly into the VM. Thanks in advance for any answers.

    Update:

    ( I will shorten this soon, and post the final script, etc. For now, for others who might need the info, here is my current solution...)

    Thanks to all for the help. Especially djsmiley2k.

    I used Task Scheduler to get a working solution as follows:

    I first created a shortcut to the VM on my desktop. (I am not at my work computer right now, so I don't have the exact info, so I will update it when I do get back to it.)

    The result is a standard shortcut, with a call to Virtualbox.exe and the parameters to pass. The working folder is also filled in, but not really needed.

    I created a .bat file and copied and pasted the info from the shortcut into it.

    Then, I went into Task Scheduler, and created a New Task, not a basic task. I called it VMStart. I set the trigger to at login, and then made the action 'start a program.' I pointed this to the .bat file. I set the task to be run with highest priviledges. This is important so that the cmd window comes up with administrator priviledges to start the VM.

    I set the Windows 10 taskbar to auto-hide, and turned off the password requirement for the user. I was logged in with the user I wish for the machine to boot up with. I adjusted the settings of the VM where the user interface has no menu and no toolbar. I set the view options to prevent the VM from changing the HOST display resolution. I started the VM, and switched it to full-screen mode. Then I made sure to set the VM screen resolution to what I wanted. I then shutdown the VM. This leaves the settings of the VM as I want it to be when it starts. The host key still works, so I can manage the VM if I need to and bring up the VirtualBox manager gui.

    Now, when I start the computer, Windows 10 boots, brings up the user I last used, and immediately logs in. As soon as the desktop comes up, the cmd window opens, and the VM starts, switches to full screen and takes over.

    For now this is enough, but I will need to lock it down more eventually. Using the answers I now have more info to work for that.

    Again, thanks for the great solutions offered!

    • Nordlys Jeger
      Nordlys Jeger over 5 years
      Welcome on Superuser. What steps have you tried so far? What about your script? Please edit your question and don't respond in the comments.
  • djsmiley2kStaysInside
    djsmiley2kStaysInside over 5 years
    A link only answer with no explaination of what it does isn't much use. Try explaining the steps involved in the linked article.
  • wgengland
    wgengland over 5 years
    You are right. Thank you, but please don't downvote it yet! I'm not here for the points, but for help and to help. Check my next post for the steps I took and how I got it to work. Thanks for your help.
  • wgengland
    wgengland over 5 years
    Thank you! I really needed the info on how to make sure it always goes to full screen. I haven't used vboxmanage very much and I have only recently used it in a script. Still learning how to use it, and this will help me alot!
  • djsmiley2kStaysInside
    djsmiley2kStaysInside over 5 years
    @wgengland if it's helped you, concider giving it an upvote ;D
  • Lance McCarthy
    Lance McCarthy about 4 years
    This was perfect as a shortcut in shell:startup folder! "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "VM1" "VM2" --type separate
  • djsmiley2kStaysInside
    djsmiley2kStaysInside about 4 years
    @LanceMcCarthy didn't realise you could fire up multiple VM's, awesome!. I am still having trouble getting them to shutdown automatically though :(