7
1
Objective
I want to run this command VBoxManage startvm MyVM --type headless
at the boot system just like a service (postgres, apache) does.
What i've tried
1. I've tried to create a service using sc command
I've found over the internet that could be the solution so i tried all this versions:
sc create "vboxMyVMService" binPath= "C:\Progman Files\Oracle\VirtualBox\VBoxManage.exe startvm MyVM --type headless"
sc create "vboxMyVMService" binPath= "C:\Progman Files\Oracle\VirtualBox\VBoxManage startvm MyVM --type headless"
No success, so i tried to suppress the verbose output of the command
sc create "vboxMyVMService" binPath= "C:\Progman Files\Oracle\VirtualBox\VBoxManage.exe startvm MyVM --type headless > NUL"
sc create "vboxMyVMService" binPath= "C:\Progman Files\Oracle\VirtualBox\VBoxManage startvm MyVM --type headless"
Still no results. All this version returned me a 1053 error. So the last call was to add the Virtualbox command to the Path
sc create "vboxMyVMService" binPath= "VBoxManage.exe startvm MyVM --type headless"
sc create "vboxMyVMService" binPath= "VBoxManage startvm MyVM --type headless"
suppressing output
sc create "vboxMyVMService" binPath= "VBoxManage.exe startvm MyVM --type headless > NUL"
sc create "vboxMyVMService" binPath= "VBoxManage startvm MyVM --type headless > NUL"
No positive result always 1053 error.
2. Assign Computer Startup Scripts
I followed this tutorial with my last hope, but no success.
What left
I'm thinking about to download the Visual Studio and try something related to create a service project.
So guys, where is my mistake? Is there hope to me?
FAQs
Can you switch you OS to linux?
- No. It's out of question.
Why you need this VM to startup at with the system?
- Unfortunately this windows 7 host is a small server for the application running over the VM. The machine it's not mine and it's the only option they gave to me to make the deploy.
Why you are not making the deploy of the application inside the windows host?
- I'm not running PHP, or any .NET stuff, so no.
Rather simpler. Have you tried using Task Scheduler with an "On Startup" trigger? Though you might actually need something more like "At log on" depending on whether you need to give time for other services to start which I suspect you do. – Julian Knight – 2015-06-02T23:04:41.993
what about sticking the
vbox X --type headless
command in a batch script that you stick in theStartup
folder, or in theHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
.. does it have to be a service? Just curious if you need thenetstart
functionality over just starting the VM in headless mode at startup? – txtechhelp – 2015-06-02T23:41:28.787@JulianKnight i need the vm running without the need to login on a specific account :( But i will check the Scheduler see if can be a plan B – vyscond – 2015-06-03T00:29:57.123
@txtechhelp didn't find anything about this folder, i will try it in a minute too. – vyscond – 2015-06-03T00:30:33.473
Trying using srvany as the service executable and use that to launch your VBoxManage command. Seems like the task scheduler idea on startup would also work. – ssnobody – 2015-06-03T00:45:31.463
@ssnobody can you provide the steps to use srvany? – vyscond – 2015-06-03T00:49:19.777
https://support.microsoft.com/en-us/kb/137890 – ssnobody – 2015-06-03T00:49:37.383
@JulianKnight @ssnobody i've tried the task scheduler but i got this message
The operation being requested was not performed because the user has not logged on to the network.The specified service does not exist(0x800704DD)
it's seems that i need now to force a login before starting the .bat file, right? – vyscond – 2015-06-03T00:50:41.913What does the batch file look like? Which service is it trying to start and failing? I don't believe you need to log on before running the VBoxManage command. Over at http://www.wolfsoftwaresystems.com/code/server-stuff/the-operation-being-requested-was-not-performed-because-the-user-has-not-logged-on-to-the-network-the-specified-service-does-not-exists-0x800704dd/ it says you must check the radio button highlighted “Run whether user is logged on or not”. once this is checked you will be prompted for the password you are trying to execute the task as.
– ssnobody – 2015-06-03T00:53:13.863@ssnobody the batch file looks like this now
"C:\Progman Files\Oracle\VirtualBox\VBoxManage.exe" startvm MyVM --type headless
. I checked the box about “Run whether user is logged on or not” after the reboot the scheduler show 0x0 as response, but the VM still not being called up.I also tried the srvany.exe which the service created runs without the error code 1053 but the VM show up as aborted. – vyscond – 2015-06-03T01:08:46.700
If it shows up as aborted look for and post the vbox log. Also, I wouldn't try both the startup script and the service at the same time, I don't know how virtualbox will respond to multiple things trying to start the same virtual machine. – ssnobody – 2015-06-03T01:12:15.587
@ssnobody i tried this tutorial which is almost the same thing i did but using VBoxHeadless command. So in my machine i had two scheduled task the 1) run the .bat as described on the question and the 2) is the running directly the VBoxHeadless. All this failures seems to lead about the order of windows to execute the base drivers/services that we need to run a vbox VM, but if is it so i'm out of my league again.
– vyscond – 2015-06-03T11:59:06.877batch files won't run under srvany. Set srvany to trigger the actual VB manage command you want. Then, set the service to depend on the virtualbox services so it won't start the srvany service until after the virtualbox services. https://support.microsoft.com/en-us/kb/193888
– ssnobody – 2015-06-04T21:53:09.467@ssnobody i tried using the VBoxManager and VBoxHeadless directly but no success :/ so i find this tool VBoxVmService which did what i wanted without much pain.
– vyscond – 2015-06-07T13:32:34.923Looks good. Probably worth posting as an answer... – ssnobody – 2015-06-07T23:18:53.740
@ssnobody well did you tested the srvany on your machine? Because i don't wanna make people believe that is not a real way achieve. If can teste it and say it worked (at least for you) it worth post as a answer, and just append the VBoxVmService as a second option. – vyscond – 2015-06-08T13:00:19.903
I didn't try it on my machine but have used srvany for controlling many binaries without issue and the post over at https://forums.virtualbox.org/viewtopic.php?f=2&t=15164 certainly suggests it's a workable solution. I would recommend you post your solution as the answer you used (since it's the only one you know for sure does work for you). Those interested in the details of the srvany can always direct themselves to the comments or someone who can actually try it can post it a separate answer.
– ssnobody – 2015-06-09T21:33:10.280