February 18, 2006

Running Vmware Player as a service

credit to http://www.windowsitpro.com/Windows/Article/ArticleID/42607/42607.html
for this acticle.


If you're a VMware enthusiast, you've probably on more than one occasion
wanted to log off from your computer while leaving your virtual machines
(VMs) running. Or, maybe you've wanted selected VMs to start as soon as
your system boots so that your host system can log on to a domain
controller (DC) running inside one of the host machine's VMs. Sound too
good to be true? That's what I thought. I assumed that logging off of my
computer and having my VMs remain running was an unattainable dream. But
I discovered that getting VMs to run as services is possible and very
easy to configure.

Tools for Service
VMware doesn't natively support running its software as a service, but
configuring VMware Workstation 4.0 VMs to run as services is almost as
easy as tying your shoes. All you need to get started are two
tried-and-true Windows resource kit tools: instsrv.exe and srvany.exe.
Both tools are available as free downloads. Go to
http://www.microsoft.com/downloads, enter Windows 2003 Resource Kit
Tools in the Keywords field, and click Go. Then, click the Windows
Server 2003 Resource Kit Tools Download button at the Windows Server
2003 Resource Kit Tools Web page to download rktools.exe-which contains
the most recent versions of Instsrv and Srvany-and run the executable to
install the tools on your system.

Note that you can install the Windows 2003 resource kit tools on a
Windows 2003 or Windows XP system. If your host system runs Windows 2000
or Windows NT, you can acquire Instsrv and Srvany from the Win2K or NT
resource kit CD-ROMs or you can install the Windows 2003 resource kit
tools on an XP system and just copy Instsrv and Srvany from the XP
system to the %windir% folder on your Win2K or NT host system. The
Windows 2003 versions of Instsrv and Srvany run on the earlier OSs
without any problems.

Getting Started
Installing the resource kit tools updates the system path to include the
resource kit installation folder. Updating the path requires a reboot,
so be sure to reboot your system after installing the resource kit.
Alternatively, you can copy Instsrv and Srvany to a folder already in
the path, such as the folder C:\windows\system32.

With the resource kit files in place, your next task is to determine the
location of the VMware application's vmware.exe file. I used the default
settings when installing VMware, so the path I needed was C:\program
files\vmware\vmware workstation\vmware.exe.

The last bit of information that you need before you configure the new
service is the path to the configuration file of the VM that you want to
turn into a service. This file is in the folder in which the VM was
created and has a .vmx extension. All my VMs are stored on my system's E
drive, so the path to the .vmx file of the VM that I want to run as a
service is E:\vms\w2k1\w2k1.vmx. When you have the vmware.exe path and a
VM's .vmx path information, you're ready to create the service.

Creating the Service
First, decide on a name for the service. I prefer to preface the name of
the VM with VM_ to form the service name. For example, I would give my
VM named W2K1 the service name VM_W2K1. After you decide on the service
name, you can use the following syntax to set up the service:

instsrv

So a sample command might be

instsrv VM_W2K1
c:\windows\srvany.exe
Now you need to modify the service's parameters by using a registry
editor and the Microsoft Management Console (MMC) Windows Services
snap-in. In the registry editor, navigate to the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
subkey. Right-click the VM service name, select New, then click Key.
Name the new subkey Parameters.

Right-click the Parameters subkey, select New, then click String Value.
Name the new value Application. Double-click the Application value and
enter the path to the vmware.exe file on your host system (put the
pathname in double quotation marks), followed by -x, followed by the
path to the VM's .vmx file (put the pathname in double quotation marks).
For my configuration, I used the string value "C:\program
files\vmware\vmware workstation\vmware.exe" -x "e:\vms\w2k1\w2k1.vmx".
Close the registry editor.

Open the Windows Services snap-in. Locate and right-click the newly
created VM service and select Properties. In the service's Properties
dialog box, click the Log On tab. Ensure that Local System account is
selected, and select the Allow service to interact with desktop check
box, which Figure 1 shows. Click OK to close the service Properties
dialog box. You can now use the Windows Services snap-in to start your
VM service. By default, the service is configured as automatic, so the
VM will start when your system starts. Each VM that you configure to run
as a service will appear in its own window on the desktop. Because the
VM is running as a service, you'll now be able to log off of your
system, and the VM will continue to run.

3 comments:

  1. Update for Windows 2008?

    ReplyDelete
  2. Hi. Here is a commercial option that supports Windows 2008:

    http://www.coretechnologies.com/products/AlwaysUp/Apps/RunVMwarePlayerAsAService.html

    ReplyDelete
  3. It won't work in Windows 7. The -x parameter also generates an error with VMWare Player 5.

    ReplyDelete