PCs

How do I... Install VMware Workstation as a Service?

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.

Requirements

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

  • Instsrv.exe
  • Srvany.exe

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:
Hints.hideall="TRUE."

Figure H

Add this line to your .vmx file to disable VMware Hints
15 comments
dr.zeugs
dr.zeugs

Hi, I went through this manual and everything works splendid ... except vmware seems to work only halfways. When I copy the "Application key value" into a batch file and start the batch file, the vmware-image starts up smoothly. In the task-manager I see two entries: vmware-player.exe and vmware-vmx.exe. When starting it up as a service I only see vmware-player.exe in the taskmanager. And I can't ping the OS I startup in the vmware image. I changed the "Log-on" setup to use the Administrator-account rather than the SYSTEM account, but that didn't make a difference. vmwareplayer.exe starts up under the username Administrator, but nothing else changes. Is there a way to debug this? Is it possible to see what's going on with the service? Can I see the graphical output somehow? Any further ideas? Thanks! Johannes

glaiv3
glaiv3

Make sure, if you installed your virtual machine into the Administrator's documents, that you set your folder access permissions accordingly! Otherwise, you will need to log in for the system to allow access to the virtual machine files and actually start.

aspemail
aspemail

"Figure E" has 3 entries, which one were you referring to in this article?

aspemail
aspemail

Can you please have a bigger image for "Figure A"

aspemail
aspemail

Looks like you have back slash missing in your sample code in this code "c:program filesvmwarevmware workstationvmware.exe" -x "d:my virtual machinesvmsuse linux 9.1suse.vmx"

griffon
griffon

This is a really good tip. I really enjoy that i can now join the host into a virtual domain.. I have obsolete hardware and this tip allow me to use the host as part of the virtual environment. Thanks for sharing

Gis Bun
Gis Bun

While it could be of use having this information, the explanation is buggy. First it mentions having a VM named vmware_dc but it then switches over to a SUSE VM. Then the line in the registry seems to be missing the backslashes (\).

Will333
Will333

Hi, sorry for resurrecting an old post but I'm also having the exact same problem. I've followed Steven's guide exactly but the service does not start up the VM. The difference I notice when starting the service is that the "vmware-vmx.exe" process in the task manager is missing, compared to if I was to manually start the VM (without using the service). I've Googled a lot of pages but most provide more or less the same steps. Would really appreciate it if someone can help me out on this.

jhbobo
jhbobo

vmware server provides the functionality to run as a services and I think it is much better way if you want to run workstation as a service, since you have to manually edit the registry. beside it is a free product and all you need to do is to register with vmware and you can get as many license keys as you want. but the catch is the VMDK filed created by workstation can't be read by vmware server. Looks to me server is more of a cut down version of workstation.

mohadadel
mohadadel

I a using Vista home premium, after running the instsrv, i got "you are not authorized to do that action contact your system administrator". Note am the local admin.

Steven Warren
Steven Warren

Thanks for the catch. The tutorial is sound and works great. Give it a shot. You will not be disappointed.

caseyfw
caseyfw

I was having the same issue. Running VMware Workstation v7.1 under Windows Server 2003. Everything looked fine, the service said it had started, and an instance of vmware.exe would appear in the task manager process list with the user being SYSTEM and using only a paltry 34 MB of memory. After a while poking around on the web I tried changing the user running the service to a local administrator account - in my case WORKGROUP\Administrator. I also changed the preferences of VMware Workstation to "Keep VMs running after Workstation closes" under the Workspace tab. I also made sure no media devices (floppy/cdrom) were connected at boot for the VM, and finally added the line: hints.hideAll = "TRUE" to the end of the .vmx file. Apparently this stops the VM from halting on hint messages. I imagine the root cause of the problem here is a permission issue with the virtual machines. I'm going to look into creating a special "services" admin user that has no login rights so I can use it as the owner of these sort of processes. Maybe someone who is a real sysadmin will come along and school us on how this is supposed to be done... :-)

Tad Diego
Tad Diego

Will they start in a new tab in the first instance of vmware workstation, or start a whole new workstation instance per vm?

The 'G-Man.'
The 'G-Man.'

I would say it may now not be valid for the latest version of Workstation. Any competent IT Pro might work that one out on their own however. :-)

ashraf.s
ashraf.s

I have same problem as you. did you find the solution for this problem?

Editor's Picks