i wanted to start the vm inside of virtualbox on a windows-host while the host-machine is starting up, and shutting down, when the host-machine is going down.
i used the following tools to do this:
1)[virtualbox]
2)[windows service commander] [NullLogics] (can be removed later)
3)[srvstart] (SRVSTART.EXE is a Win32 executable and DLL which allows you to run commands as if they were Windows NT services.)
4)[hstart] (Hidden Start (or Hstart) is a small startup manager that allows console applications to be started without any windows in the background and much more. )
install virtualbox, and windows service commander, and unpack srvstart and hstart in one dir create a file called srvstart.ini, that looks like this
example:
[vbox_configuration] startup=c:\programme\sun\virtualbox\virtualbox.exe [pxesrv] startup=C:\srvstart\hstart.exe /NOCONSOLE /WAIT "c:\programme\sun\virtualbox\vboxheadless.exe --startvm pxe_server -p 3391" shutdown_method=command shutdown=c:\programme\sun\virtualbox\vboxmanage.exe controlvm pxe_server acpipowerbutton
start the windows service commander and create two services (screenshot)
the first one is needed to configure the virtual box in the context of the Rights of "LocalService".
(as manually started service)
C:\srvstart\srvstart.exe vbox_configuration -c c:\pxe-boot-utils\srvstart\srvstart.ini
the second one is to start and stop the vm
(as automatically started service)
C:\srvstart\srvstart.exe pxesrv -c C:\srvstart\srvstart.ini
when done, you can start the "configure-service" manually and create a new virtual machine (it has to have the same name as mentioned in srvstart.ini), and configure it.
hint: if you allready work via remote-desktop on the host machine, and you try start the "configure"-service (configuration-tool of virtualbox) then you will see nothing, i don't know how to fix this issue!)
your vm will start/shutdown when your windows-host-system starts or does a shutdown. you will be able to connect to your vm via remote-desktop on localhost port 3391, if needed.