Close Virtual Machine Session

Discussions related to using VirtualBox on Windows hosts.
Post Reply
shane297
Posts: 6
Joined: 16. May 2009, 16:58
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: SBS 2008

Close Virtual Machine Session

Post 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.
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Close Virtual Machine Session

Post 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.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
shane297
Posts: 6
Joined: 16. May 2009, 16:58
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: SBS 2008

Re: Close Virtual Machine Session

Post 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?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Close Virtual Machine Session

Post 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
Hans Eberhardt
Posts: 76
Joined: 22. Mar 2008, 01:49
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows XP
Location: Feuchtwangen, Germany

VBoxTotallyHeadless

Post by Hans Eberhardt »

Really good hack. :D
Please tell us, for which Versions this does apply.
Thanks,
Hans
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Close Virtual Machine Session

Post by vbox4me2 »

Applies to any executable which has the same header at the same offset.
shane297
Posts: 6
Joined: 16. May 2009, 16:58
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: SBS 2008

Re: Close Virtual Machine Session

Post 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.
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Close Virtual Machine Session

Post by baf »

Untested:

try redirecting output to nul.
Something like.
VboxHeadless -s machine >nul 2>&1
Should send everything down the drain...
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
shane297
Posts: 6
Joined: 16. May 2009, 16:58
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: SBS 2008

Re: Close Virtual Machine Session

Post by shane297 »

@baf - When I run this, it takes the cursor to the next line but still requires the window session to remain open.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Close Virtual Machine Session

Post 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 6841 times
shane297
Posts: 6
Joined: 16. May 2009, 16:58
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: SBS 2008

Re: Close Virtual Machine Session

Post by shane297 »

Ok. I found it now. That works great. This is a good alternative to srvany or srvstart. Thanks a lot.
Post Reply