@renoes: any idea why the service does not stop gracefully under windows without the net stop batch file? Thanks for the solution too!
If anyone wonders how to hide the console windows on Windows, here is what I did:
1. download this tool http://www.nirsoft.net/utils/nircmd.html
2. extract the files to c:\vm\nircmd
3. in c:\documents and settings\all users\start menu\programs\startup
create a file called hidevm.bat containing the following line:
c:\vm\nircmd\nircmd win hide ititle "vboxheadless"
there may be a way to set this up as a service, but I keep getting errors starting it.
HOWTO - virtualbox as a service on Windows (srvstart.exe)
-
- Posts: 1
- Joined: 28. Nov 2009, 10:11
- Primary OS: MS Windows Vista
- VBox Version: OSE Debian
- Guest OSses: Ubuntu, XP, Windows 7
-
- Posts: 1
- Joined: 4. Dec 2009, 22:52
- Primary OS: MS Windows XP
- VBox Version: OSE other
- Guest OSses: Windows XP Debian linux, Ubuntu Linux
Re: HOWTO - virtualbox as a service on Windows (srvstart.exe)
There was huge difference for me, because this method worked, whereas vboxvmservice didn't. I spent several hours about a year ago trying to get vboxvmservice working (XP x64 host, XP 32 guest), and finally gave up on it. I spent a few hour on this one too, but got it to work, and it's very helpful. My guest OS can be updated automatically without keeping the host logged in, and when auto-updates make the host reboot, my guest saves state instead of being hard powered off.rasker wrote:There isn't a huge difference between the two approaches ...
I, too, had to put in a shutdown script with a "net stop" to get it to save state on a host restart. I'm by no means an expert on Windows services, but after a little googling around, it appears that a system shutdown triggers a different event from stopping the service. It would seem that srvstart does not handle the system shutdown event properly. Possibly these two events were the same on older versions of Windows, as srvstart is obviously pretty old -- the documentation mentions NT 4.0 and Windows 2000, but not XP or Server 2003, let alone Vista, Server 2008 or Windows 7.
Thank you very much for this HOWTO. It's been extremely useful. Now if we could just get the sun folks to make running as a service part of the standard functionality for Windows hosts.
-
- Posts: 5
- Joined: 19. Aug 2009, 20:06
- Primary OS: Ubuntu 8.10
- VBox Version: OSE Debian
- Guest OSses: Windows XP Pro SP2
Re: HOWTO - virtualbox as a service on Windows (srvstart.exe)
Windows Server 2008 R2 does not have a "LocalService" folder under the folder "Users". So where I'm suppossed to paste the virtualbox.xml file copied from the original .VirtualBox folder?2. Next, close the VirtualBox GUI and copy the virtualbox.xml file from the c:\Documents and Settings\<your_login_name>\.VirtualBox\ directory to the c:\Documents and Settings\LocalService\.VirtualBox\ directory.
-
- Posts: 5
- Joined: 19. Aug 2009, 20:06
- Primary OS: Ubuntu 8.10
- VBox Version: OSE Debian
- Guest OSses: Windows XP Pro SP2
Re: HOWTO - virtualbox as a service on Windows (srvstart.exe)
I can not find the folder "c:\Documents and Settings\LocalService" on the Windows Server 2008 R2. Since I don't think that Windows Server 2008 R2 have a LocalService account, where am I supposed to move the folder ".VirtualBox" to?2. Next, close the VirtualBox GUI and copy the virtualbox.xml file from the c:\Documents and Settings\<your_login_name>\.VirtualBox\ directory to the c:\Documents and Settings\LocalService\.VirtualBox\ directory.
-
- Posts: 1
- Joined: 9. Dec 2010, 20:15
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: WinXP
Re: HOWTO - virtualbox as a service on Windows (srvstart.exe)
They're saying C:\Windows\System32\config\systemprofile\AppData\Roaming\.VirtualBox
I copied my xml file there but when I edit it, it shows that it's EMPTY. However, the filesize is 2kb. I suppose I should mention that the service won't run, and the log says the same thing as hanoirocks' did.
SRVSTART: 2010/12/09 12:28:58 INFORMATION severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\exe\exe.cpp line=322 text=SRVSTART version 1.10 Copyright (C) 1998 - 2000 Nick Rozanski (Nick@Rozanski.com) (Distributed under the terms of the GNU General Public License as published by the Free Software Foundation)
SRVSTART: 2010/12/09 12:28:58 INFORMATION severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\exe\exe.cpp line=324 text=To hide the startup message run SRVSTART with switch -d 0
SRVSTART: 2010/12/09 12:28:59 ERROR severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\dll\CmdRunner.cpp line=1444 text=getProcessStatus(): command failed with exit code 1
SRVSTART: 2010/12/09 12:28:59 ERROR severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\dll\CmdRunner.cpp line=1130 text=watchCommand: process has finished with error
I'm at a loss here, I've scoured everything over line by line and don't see a difference between what you guys are doing, and what I'm doing. Except I'm on Win7 and that seems to be a huge issue for this method.
I copied my xml file there but when I edit it, it shows that it's EMPTY. However, the filesize is 2kb. I suppose I should mention that the service won't run, and the log says the same thing as hanoirocks' did.
SRVSTART: 2010/12/09 12:28:58 INFORMATION severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\exe\exe.cpp line=322 text=SRVSTART version 1.10 Copyright (C) 1998 - 2000 Nick Rozanski (Nick@Rozanski.com) (Distributed under the terms of the GNU General Public License as published by the Free Software Foundation)
SRVSTART: 2010/12/09 12:28:58 INFORMATION severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\exe\exe.cpp line=324 text=To hide the startup message run SRVSTART with switch -d 0
SRVSTART: 2010/12/09 12:28:59 ERROR severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\dll\CmdRunner.cpp line=1444 text=getProcessStatus(): command failed with exit code 1
SRVSTART: 2010/12/09 12:28:59 ERROR severity=0 thread=6200 source=D:\Home\Author\srvstart.v110\dll\CmdRunner.cpp line=1130 text=watchCommand: process has finished with error
I'm at a loss here, I've scoured everything over line by line and don't see a difference between what you guys are doing, and what I'm doing. Except I'm on Win7 and that seems to be a huge issue for this method.
-
- Posts: 2
- Joined: 28. Feb 2012, 02:02
Re: HOWTO - virtualbox as a service on Windows (srvstart.exe
To get this excellent solution running under Windows Server 2008 R2 as Host OS,
You need to point your .VirtualBox Folder to
C:\Windows\System32\config\systemprofile\.VirtualBox
And if you don't want to copy your config file to this location every time you change anything, link the VirtualBox.xml to it's originial location using the mklink command...
You need to point your .VirtualBox Folder to
C:\Windows\System32\config\systemprofile\.VirtualBox
And if you don't want to copy your config file to this location every time you change anything, link the VirtualBox.xml to it's originial location using the mklink command...