Page 1 of 1

Using VBOXMANAGE to detach GUI possible?

Posted: 28. Dec 2021, 22:12
by FutureTense
I have a windows Powershell script (follows) that takes a list of VM names from a text file and starts each of them up in headless mode.

Code: Select all

[string]$VBoxManage="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"

$ini = $MyInvocation.MyCommand.Name.Replace(".ps1",".ini")
$ini = [IO.Path]::Combine($ScriptPath,$ini)

$vms = Get-Content -Path $ini
foreach($vm in $vms)
{
    $arguments = 'startvm ' + '"' + $vm + '"' + ' --type headless'
    start-process -NoNewWindow $VboxManage $arguments 
} 
Assuming I start every VM in a headless state, how can I show and hide a VM?

For example, what would I do to the $argument variable below to show the GUI and hide/detach the GUI?

Code: Select all

foreach($vm in $vms)
{
    $arguments = 'startvm ' + '"' + $vm + '"' + ' --type headless'
    start-process -NoNewWindow $VboxManage $arguments 
} 

Re: Using VBOXMANAGE to detach GUI possible?

Posted: 29. Dec 2021, 00:27
by scottgus1
Show an already-headless-started VM:

vboxmanage startvm "vm name" --type separate

There is no command line to hide a detachable/separate-started VM (Enhancement request here: https://www.virtualbox.org/ticket/16093).

There is a menu command to hide the detachable/separate-started VM's GUI in the VM window's Machine menu, Detach GUI. A Host-key combo can be set up to activate that menu command, and it may be possible to set up a host keyboard 3rd-party command script (AutoIt?) to activate the menu command or the Host-Key combo.