Page 1 of 1

VirtualBox VM to run at Windows start up (using Win Service)

Posted: 28. Sep 2009, 19:55
by danboh
Hello All,

I was able to configure a service in Windows that runs a batch file at system startup. The main reason is so we can trust that if the host server goes down for whatever reason, at startup it will boot all VM's without any Human interaction.

The services works well, but not the batch file. Im using VirtualBox's function called startvm but for some reason it's not working properly when starting the service. If I run the batch file, it will start the VM normally without any problem. But if I start the service (previously configure to run the same batch file) it shows that there's a problem with the name of the VM and says that there's no VM registered under that name. Same happens if I use the UUID, or even if I list the VMs using list vms command, it won't show anything. I'm not sure what's the difference between running the batch file only and running it using a service.

I sill don't know why VirtualBox devs have not come up with a solution for this. VMWare has a functionality to start VM's at system startup.

Any ideas will be truely appreciated.

Thanks!

Re: VirtualBox VM to run at Windows start up (using Win Service)

Posted: 28. Sep 2009, 20:34
by Mr Incredible
Follow the instructions here:

http://thelivedevil.com/virtualbox/how- ... n-windows/

See my comments at the end about the syntax of the srvstart.ini and user profile account.

I've got VM running as a service now after experiencing the same issues as you with respect to batch files.

This is my srvstart.ini

Code: Select all

env=VBOXGUI="C:\Program Files\Sun\VirtualBox\virtualbox.exe"
    env=VBOXHEADLESS="C:\Program Files\Sun\VirtualBox\vboxheadless.exe"
    env=VBOXWEBSRV="C:\Program Files\Sun\VirtualBox\vboxwebsrv.exe"
    env=VBOXMANAGE="C:\Program Files\Sun\VirtualBox\VBoxManage.exe"
    env=VBOX_PROG="C:\Program Files\Sun\VirtualBox\"
    env=VBOX_BASE="C:\Users\Mr Inredible\.VirtualBox\"
    env=VBOX_MACHINES="C:\Users\Mr Incredible\.VirtualBox\machines\"
    env=VBOX_VDI="I:\VirtualBox\"                           **************** note this is the location of your VDI file   ******************
    env=USERPROFILE=%SystemDrive%\Users\Default\       ******** if you have a problem creating a directory called ".VirtualBox", just copy the one from your own user area.*********

	debug=0
	debug_out=>C:\vm\vm.log

    [VBSERVER]
    startup=%VBOXHEADLESS% --startvm VBSERVER --vrdp=config      *******  headless mode  **********
    shutdown_method=command
    shutdown=%VBOXMANAGE% controlvm VBSERVER savestate

Re: VirtualBox VM to run at Windows start up (using Win Service)

Posted: 28. Sep 2009, 21:04
by danboh
Thank you, however I think that there's got to be an EASIER and much simpler way to do this. 32 steps to boot automatically an application as a service is not really acceptable (from the user point of view).

I will give it a try though.

Re: VirtualBox VM to run at Windows start up (using Win Service)

Posted: 28. Sep 2009, 21:08
by Mr Incredible
What is your Host application?

Re: VirtualBox VM to run at Windows start up (using Win Service)

Posted: 28. Sep 2009, 21:15
by danboh
I gues by Host you mean the OS? In that case it's Windows 2003 Server R2