7

Oracle VirtualBox on Windows

Hi All,

Is there a way to start a vm headless (vboxheadless -s ) but one can close that command window or if I add that as a startup item will that make it run silent ?

I have successfully exported a appliance (linux vm), when I will do the batch import will it retain the settings I had configured originally or will one would have to assign bridged adapter, amount of ram, etc ?

will be grateful for your suggestions ! Kind Regards

EDIT : Iain, if one wants to script the GuestAdditions install on first boot in a CentOS VM, shall I just put the commands ./VBOXLinux-x86-additions.run to the bash script and it will run at startup, any thoughts on this would be really helpful.

Kind Regards

2
  • Does the export also take care of hardware configurations? I thought there was post-changes that had to be done sometimes, but maybe I'm out of date with doing that. Or all I did was convert a drive format so they could be mounted in a different VM system, not actually run the OS from there. Commented Oct 6, 2010 at 12:47
  • There is some info here on scripting the GA install. I've never tried it though.
    – user9517
    Commented Oct 17, 2010 at 21:45

5 Answers 5

4

If you use

vboxmanage import ovffile.ovf --dry-run

you will get a report telling you what configuration is going to be applied when the import is actually done. You'll also get advice on how to make changes if required.

As to running vboxheadless detached from a command line and a window it's not as straightforward as you may think. A simple

start /b vboxheadless -s vmname

appears to work in that it detaches from the command line but if you close the window the child process dies too and the 'power cord' is pulled from your vm.

To solve this use a small vbs script test.vbs

Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("c:\temp\test.bat", 0)
set WshShell = Nothing

My test.bat

@echo off
vboxheadless -s vmname
16
  • 1
    Yes, that's how to use it. You can change the name of the batch file, just edit the vbscript accordingly.
    – user9517
    Commented Oct 7, 2010 at 15:46
  • 1
    The keys will all be the same and so (in your environment) should work as you want.
    – user9517
    Commented Oct 8, 2010 at 9:29
  • 1
    If your system will shut down cleanly when sent the acpipowerbutton event is sent try vboxmanage controlvm VMName acpipowerbutton
    – user9517
    Commented Oct 14, 2010 at 12:04
  • 1
    `backtics are your friend`
    – user9517
    Commented Oct 14, 2010 at 13:57
  • 1
    I can only force that error message buy trying to talk to the machine when it's powered off - are you sure the machine is running ?
    – user9517
    Commented Oct 14, 2010 at 19:09
3

This is pretty old post but I spent a lot of time looking for this

Here's what I use

VBoxManage.exe startvm "myvm" --type "headless"

And to stop it

VBoxManage.exe controlvm "myvm" savestate 

or poweroff

I have put these in the Widows 7 task scheduler so it starts and stops with Windows.

Start:
Trigger at start up

Shut down:
Trigger on an Event

System event:
Source User32
Event ID 1074

The one issue I have found with this is if the IP changes it becomes difficult to figure out the right IP address.

2
  • Nice. But on Win10 trigger 'at startup' does not work for me, only 'at log on' works.
    – kyb
    Commented Oct 23, 2017 at 11:15
  • @Karl Which user account are you using to run these tasks in the scheduler? Is Run whether user is logged on or not selected? (Or Run only when user is logged on?) The former requires running VBoxHeadless non-interactively, and VBoxManage.exe is not able to find it during shutdown. Commented Aug 11, 2019 at 22:07
0

AFAIK when you import the applicance it will hold the settings you had on the machine you exported it from.

See if this post on the VirtualBox forum can help you.

0

This works well for me

VBoxManage startvm --type headless "Name of guest to start"
0

I am using a small opensource application named VBoxVmService, which is very helpful in this type of scenario. It enables you to run your VirtualBox VMs in headless mode as windows services (one service for each VM). It is hosted on Sourceforge at:

http://vboxvmservice.sourceforge.net/

You can configure the VMs to start as service in a simple ini file. Documentation is provided with the download.

Be aware of the fact that the started VMs do not show up in the VirtualBox GUI application as started (differing from Linux, where those can be seen). If you should need to reconfigure your VMs, you will need to shutdown the service first (the supplied tray miniapp of VBoxVmService is very helpful there), then make the change in the VirtualBox GUI and then lauch the VM service again.

I added this proposal, because it may be more convenient to some users...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .