First of all, thanks to mattz for such a great tool! This is exactly what I wanted to run with VirtualBox.
However, when I tried to install on my Windows 7 64bit host and followed exactly every step as in mattz's manual, the virtual machine can never get started. I looked into calls in startup_cli.bat and find the call to runasv always failed as someone else has pointed out. I spent more hours trying to make it work and finally I find out a way. Here is the trick: you don't really need runasv and runserv to get the virtual machine start or stop. Instead, just call "VBoxManage.exe startvm" and "VBoxManage.exe controlvm" directly at the startup and shutdown batch (and thus exe) files.
Here are the steps in more details:
1. Install VBoxVmService exactly as described in the manual;
2. Go to VBoxVmService installation folder, copy two bat files, startup.bat and shutdown.bat, from subfolder src\bat to here.
3. Open startup.bat, and remove anything related to runserv, then change the line
Code: Select all
echo "%VMSInstallPath%\tools\runasv.exe" "%VMSInstallPath%\tmp\u_%VmId%_sub.exe" "\%RunAtDomain%\%RunAsUser%" "%UserPassword%" > "%VMSInstallPath%\tmp\u_%VmId%_run.bat"
with something like
Code: Select all
call "%PathToVBoxManage%" startvm "%VmName%" --type vrdp >> "%VMSInstallPath%\VBoxVmService.log"
also remove other lines related to "u_%VmId%_sub" and "u_%VmId%_run", you don't need them any more.
4. Do the same for shutdown.bat, but this time call VBoxManage.exe with paramater controlvm:
Code: Select all
call "%PathToVBoxManage%" controlvm "%VmName%" "%ShutdownMethod%" >> "%VMSInstallPath%\VBoxVmService.log"
5. Test your modified startup.bat and shutdown.bat. If everything goes well, you could start your vitrual machine with
and stop it by
If you see any error in the command line or the log file, get it fixed and run the bat again.
6. Convert the bat files to exe files.
Code: Select all
tools\bcompile.exe startup.bat startup.exe -hidden
tools\bcompile.exe shutdown.bat shutdown.bat -hidden
7. Now you could start and stop the VBoxVmService service and see the virtual machine started and stopped. That's it.
For those impatient, or people don't want to modify the bat files themself, I've attached here a zip file, which contains modified startup.bat, shutdown.bat, as well as converted startup.exe, shutdown.exe. Just uncompress the VBoxVmService installation folder and your VBoxVmService service should run. I hope you find it useful. Please note I've not tested my modifications on any host other than mine, so their might be errors need to be adjusted by yourself.