Vmware Run Workstation or Player As A Service

How do I… Install VMware Workstation as a Service?

By Steven Warren
From TechRepublic

Takeaway: Under default conditions, VMware Workstation does not support the ability to run virtual machines as a service. Stephen Warren shows you can change the default behavior using the Windows 2003 Resource Kit.

Currently, VMware Workstation does not support the ability to run virtual machines as a service. As soon as you log off your computer, the running virtual machines are shut down or powered off. If you can install virtual machines as a service, you can perform the following:

Enable your host system to logon to a virtual domain controller.
Save time booting your virtual machines.
Here is how you can install VMware Workstation as a service.

This blog post is also available as a TechRepublic Download and as a TechRepublic Photo Gallery.


In order to run virtual machines as a service, you must have the following Windows Resource Kit Tools:

Download the Windows 2003 Resource Kit tools (rktools.exe) and install them. After you install the tools, copy the instsrv.exe and srvany.exe to the windows\system32 directory. It is then recommended that you reboot your computer.

Configuring VMware Workstation as a service

The first step to configuring VMware Workstation as a service is to locate the VMware Workstation executable. The default location of the VMware Workstation executable is c:\program files\vmware\vmware workstation\vmware.exe.

Once you have located VMware.exe, the crucial step in the process is to locate the path of the configuration file of the virtual machine that you want to turn into a service. In a virtual machine the .vmx file is the file that stores the configuration for a virtual machine. In order for VMware Workstation to run as a service, you have to be able to locate the path to the .vmx file.

For example, if your virtual machines are all saved to D: the path would be as follows: D:\My Virtual Machines\Workstation\winXPPRO.vmx. Once you have the path to the executable and the path to the configuration file, you are ready to create the service.

Creating the service

First it is recommended that you create a name standard for all of your virtual machines. For example, if you are creating a domain controller to run as a service, you might call it vmware_dc. Once you have the standard, click Start | Programs| Accessories | Command Prompt and type the command shown in Figure A.

Figure A

This will create a service that will automatically run the SuSE 9.1 operating system.

Next, open the registry by clicking Start | Run |. Then type regedit and expand
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\”name of your VMware Service subkey”.

In this example, the name of the service is VMWARE_SUSE. Right-click on the VMWARE_SUSE name key and choose New | Key and call the subkey parameters as shown in Figure B.

Figure B

Subkey parameters

Next, right-click on the Parameters subkey and choose New | String Value and call the key Application, as shown in Figure C. Double-click the Application key value and enter the path to the vmware.exe and the virtual machine’s .vmx file as shown in Figure D.

Figure C

Create the Application key

Figure D

Enter the path to the vmware.exe virtual machine’s .vmx file

The default path is C:\program files\vmware\VMware Workstation\VMware.exe followed by the path to the virtual machine’s .vmx file. Remember to put this path in double quotation marks.

"c:program filesvmwarevmware workstationvmware.exe" -x "d:my virtual machinesvmsuse linux 9.1suse.vmx"
Now that you have added the path, you need to set the start-up options for the newly created service. Click Start | Run | and type services.msc and browse to the service you just created for your VMware Workstation virtual machine (see Figure E).

Figure E

Set the start-up options for the newly created service

Double-click on the service and select the Log On tab. On the General tab choose Automatic as the startup type and then select the Log On tab and select the Local System account to run the service (see Figure F).

Additionally, you also need to select Allow service to interact with the desktop. Next, test the service by starting it and watching your virtual machine start. You might be prompted to create a new unique identifier as shown in Figure G. The final test is to reboot your machine to make sure the virtual machine starts as well. You can repeat these steps for as many virtual machines as your system can handle.

Figure F

Select the Local System account

Figure G

Create a unique identifier

When running virtual machines as a service, make sure all floppy drives, CD-ROM, and other devices are disconnected. It is also recommended that you disable VMware Hints by adding the following line (Figure H) to your *.vmx file:

Figure H

Add this line to your .vmx file to disable VMware Hints

Publish a VMPlayer Virtual Machine as service

by alefesta

I’ve been asked if it was possible to run a VM Player as a service so to start automatically a specific VM when the phisical host bootstrap.

My first concern is “why I should do that when VMware itself clearly states that for this specific need one should use VMWare Server? ” ,but after a short consideration on the possible answers I came to the conclusion that, beside the common sense (aka use VMware server at least) there could be special cases, like:

The physical host where you want to run the VM cannot install VMware Server
You need something that could be easily moved/copied on another physical machine without too much effort
You have to run a single VM and there is nobody to control its state or to restart the VM in case of need.
So how I may do? VMPlayer is not built to run as a service but I recalled that, on a Windows machine, you may transform any executable in a service with two executable from the resource kit instsrv.exe and srvany.exe so my first attempt was quite easy:

Install the Windows Resource Kit on a windows machine
Copy instsrv and srvany in the windowssystem32 folder or add them to the path
Launch the command to install vmplayer as service:
instsrv VMPlayer “%SYSTEMROOT%System32srvany.exe”

Or as stated in the MS article http://support.microsoft.com/kb/q137890/

At this point I’ve added a couple of registry keys so to start the VM correctly that means :
KEY “AppParameters” and “AppDirectory” in HKLMSYSTEMCurrentControlSetServicesVMPlayer
The path to the VMX of the VM I want to start in AppParameters and the Directory where the VM reside in AppDirectory.
At this point I simply started the service and…NOTHING! Well the VMPlayer appear in the TaskManager list and the service was correctly started but the VM not. After a brief investigation I found out the problem, seems that srvany is not able to launch the vmx since it is not able to launch something that it is not and executable .

I’ve tried two solution:

Launch directly the VMX.
Launche Vmplayer from command-line in this way : vmplayer “pathtovmx”
Manually both works correctly but again there is no way to use them “inside” the newly created service, so now what? I found this really well done article, written in 2001 by “Nishant Sivakumar”, called “Beginner’s introductory guide to writing, installing, starting, stopping NT services” http://www.codeproject.com/system/serviceskeleton.asp after a deep read of it I’ve started to google around for something more tangible since develop my own service was not my primary intention and found this very well done application “Launch Serv 2.0” by “Ernesto Villarroel Zapata” (http://emutastic.emulation64.com/netosoft) .

The whole process is simple or, at least, seems simple, all I have to do was to download Launch Serv, configure the ini file and click on the install.bat, at this point I’ve opened the Task Manager and observed the list of applications but something goes wrong, I may see the vmplayer.exe and the vmware-vmx.exe and….another vmplayer.exe !!! What the… I tried to stop the service but one of the two vmplayer.exe remains and so the vm. What I found out is that when I start the service I effectively launched the player but when the parameter launch the vmx it start a second player totally uncontrolled.

So now? Well Launch Srv may launch any kind of executable so even a command/bat file so the idea is “I launch a simple bat that makes nothing” and as parameter I launch the vmx file. The vmx will open the player by itself in a single instance mode and I may so control its behavior through the service.

But what if I stop the service? The VM will be halted ? Again VMPlayer got a lovely setting that suspend the VM if you close the player and so will do if you stop your newly created service.

So the answer is: yes you may run vmplayer as a service but as VMWare state if you can use VMWare Server.