Page 1 of 1

Close Virtual Machine Session

Posted: 16. May 2009, 17:32
by shane297
I am running Vista 64bit Host with Windows SBS 2008 Guest. Is there a way to close the Virtual Machine session and keep the guest OS running without having to shut it down? To explain further, I first open the Virtual Box GUI, then start the Virtual Machine. The guest session window opens and starts the guest OS. At this point I can close the VirtualBox GUI and the guest session window continues to run. I would also like to close this guest session window but keep the guest OS running in the background.

If this is not possible, can the guest session window be launched without having to open the Virtual Box GUI? Is there an independent executable for this? If so, then I can launch this as a background service.

Re: Close Virtual Machine Session

Posted: 16. May 2009, 17:47
by baf
No a Gui session can not be closed without stopping/saving the guest
But look for VBoxHeadless and VBoxManage startvm in the manual and forum.
Then you could connect with vrdp to the guest.

Re: Close Virtual Machine Session

Posted: 17. May 2009, 05:06
by shane297
I am able to launch the VM using the vboxheadless command. However, this has opened a cmd window with the "listening on port 3389" status. Is there a way to launch vboxheadless without running this window?

Re: Close Virtual Machine Session

Posted: 17. May 2009, 14:28
by vbox4me2
Yes if you are willing to hack vboxheadless, open the exe in a hexeditor, jump to 248(decimal), you will see a line like:

50 45 00 00 4C 01 04 00 35 B8 0E 3D 00 00 00 00
Jump 5 lines down, you will see someting like this:
00 50 00 00 00 10 00 00 4E B9 00 00 03 00 00 00
Where the value is 03 change it into 02 (forth from the right).

Doing this you have changed vboxheadless into a console-less app, it will NOT show anything anymore, so keep a copy if you want to see anything.

From a script you then run "start "VMNAME" /min VBoxheadless -startvm VMNAME -v config"

Insert standard disclaimer

VBoxTotallyHeadless

Posted: 17. May 2009, 15:07
by Hans Eberhardt
Really good hack. :D
Please tell us, for which Versions this does apply.
Thanks,
Hans

Re: Close Virtual Machine Session

Posted: 17. May 2009, 15:17
by vbox4me2
Applies to any executable which has the same header at the same offset.

Re: Close Virtual Machine Session

Posted: 17. May 2009, 19:13
by shane297
I am not finding either of these lines or anything similiar in the vboxheader.exe file.

50 45 00 00 4C 01 04 00 35 B8 0E 3D 00 00 00 00
00 50 00 00 00 10 00 00 4E B9 00 00 03 00 00 00

I downloaded "free hexeditor neo" from http://www.hhdsoftware.com/Products/hom ... -free.html. I am using VirtualBox 2.2.2 for Windows.

Re: Close Virtual Machine Session

Posted: 17. May 2009, 19:28
by baf
Untested:

try redirecting output to nul.
Something like.
VboxHeadless -s machine >nul 2>&1
Should send everything down the drain...

Re: Close Virtual Machine Session

Posted: 17. May 2009, 19:39
by shane297
@baf - When I run this, it takes the cursor to the next line but still requires the window session to remain open.

Re: Close Virtual Machine Session

Posted: 17. May 2009, 19:47
by vbox4me2
Note the 03 value as last marked, values in between may vary between vbox versions. And make sure insert mode is off :lol:
untitled1.jpg
untitled1.jpg (55.17 KiB) Viewed 6842 times

Re: Close Virtual Machine Session

Posted: 17. May 2009, 23:36
by shane297
Ok. I found it now. That works great. This is a good alternative to srvany or srvstart. Thanks a lot.