VMware Workstation is powerful desktop virtualisation software for software developers/testers and enterprise IT professionals that runs multiple operating systems simultaneously on a single PC.


So why run VMware virtual machines under FireDaemon? Several reasons:

  • Normally, virtualised operating systems (virtual machines) can only be run manually after a user has logged in. FireDaemon Pro allows you to start one or more virtual machines in the background prior to logging in at system boot/reboot
  • Allow multiple virtual machines to be suspended or stopped when the host machine is shutdown or rebooted
  • Use FireDaemon Pro as a centralised VMware virtual machine launcher
  • Allow individual virtual machines to be bound to specific processors on multi-processor or multi-core machines
  • Use FireDaemon Pro in conjuction with FireDaemon Fusion to manage FireDaemon and other Windows services via a web browser.

The example below covers running setting up and running Ubuntu as a VMware virtual machine under FireDaemon v3.0 in Windows 7 Professional 64Bit.


VMWare Virtual Machine Setup

Install VMware Workstation into the directory of your choice, typically C:\Program Files (x86)\VMware.


Start VMware Workstation.


Create a New Virtual Machine using the Virtual Machine Wizard. Follow the Wizard, decide the Virtual machine configuration type, guest operating system, virtual machine location, network type and disk capacity.


Note: If you want your Virtual Machine to be accessible to all users who use the computer, set the virtual machine location outside of your windows user directory. The C:\VMWare VMs directory is a good choice.


Boot your virtual machine and install your guest operating system. Don't forget to install the VMware tools. Shut down or suspend your virtual machine.


Setting Up VMWare Workstation Under FireDaemon Pro

Download and install FireDaemon Pro into the directory of your choice, typically C:\Program Files\FireDaemon.


Next start the FireDaemon GUI from the desktop shortcut. Click on the "Create a new service definition" button in the toolbar (or type Ctrl+N) and enter the information into the fields as you see below. Adjust the paths to suit your installation. Note the required parameters.


The Parameters list defines which virtual machine or team of virtual machines to start. The -x option powers on a specific virtual machine or team. The Parameters list can be left blank if you just want to start VMware without starting a specific virtual machine. Replace "C:\VMWare VMs\name.vmx" with the path and filename of the VM you want to use.

If you want to start a specific virtual machine, here’s the full parameter list you should have:
-x "C:\VMWare VMs\name.vmx"


Now click on the Settings tab. If you want to see VMware running, check Interact with Desktop. If you want to bind your virtual machine to a specific CPU or change the overall CPU priority of the virtual machine, you can do so in this tab. You can even delay the start of your virtual machine by specifying a Pre-Launch delay. This is useful if you are starting multiple virtual machines at system boot and want to stagger their initialisation.


Click on the Dependencies tab. Make sure your virtual machine is dependent on the Workstation (lanmanworkstation) or other late starting service. This is to ensure the TCP/IP and CIFS stacks are properly initialised.


You might consider making your virtual machine service additionally dependent on the following services depending on how you have configured networking in each virtual machine:

  • VMware Authorization Service
  • VMware DHCP Service
  • VMware NAT Service


Click on the Environment tab. When you stop your service you need to use the vmrun.exe utility. For that utility to run correctly, you need to include the path to your VMware installation in your system PATH variable. This can be done globally or can be done on a per service basis.


To set the PATH environment variable, click the Insert button and enter:


Variable Name: PATH
Variable Value: C:\Program Files (x86)\VMWare;%PATH%


Then click OK. Environment expansion will occur when the service is run.


Click on the Pre / Post-Service tab. When your machine is shutdown or rebooted you need to make sure your virtual machine is stopped or suspended safely.


Click on the Insert button in the Post-Service Program section and fill out the Post Service form as follows. Adjust the paths to suit your installation, then click OK:

Executable: C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe
Working Directory: C:\VMWare Machines
Parameters: suspend Ubuntu.vmx
Execution Time: 20000
Run Program: Before Event


The Parameters field defines the action to be taken against the virtual machine prior to the service being stopped. In this case the virtual machine is suspended. You can stop the virtual machine by changing the parameters to read: "stopUubuntu.vmx". Be very generous in your execution time as it may take some time for your virtual machine to be suspended.


Note: When your virtual machine is started or restarted, it will usually take many minutes until it fully loads. The exact time will be dependant on your computer hardware and the size or type of virtual machine being loaded.


That's it! You're done. Click on the OK button. Your virtual machine will be installed as a system service and started automatically.


Post-Installation Notes

Don't forget you can export your FireDaemon service configuration as XML. Drag and drop the service configuration from the FireDaemon GUI onto your desktop.

If you are running a large number of virtual machines simultaneously, you might need to increase the amount of time allocated to shutdown all services cleanly when you machine is shutdown or rebooted. For more information see this guide.


Enhancing the Performance of Your Virtual Machine

VMware can place quite a burden on your machine. Here are some tips to get the best out of it. Things to do on the host OS are marked [HOST], in VMware are marked [VMWARE] and on the guest OS are marked [GUEST].
  • [HOST] Buy more RAM!
  • [HOST] Make sure you defragment the guest OS and the file system on which the guest OS resides from time to time
  • [HOST] Install your guest OS on an NTFS partition with a big cluster size (ie. > 4096). Makes loading the guest OS much faster.
  • [HOST] Set DisablePagingExecutive in the registry to 1. This stops the NT kernel and drivers from being swapped to disk. More info here.
  • [HOST] Set LargeSystemCache in the registry to 1. This will also keep more "touched" memory pages in RAM but your mileage may vary. More info here.
  • [VMWARE] Only use one virtual processor (on multi-CPU, multi-core machines) and force each guest OS onto one CPU or core via FireDaemon's CPU setting. This will keep your machine responsive.
  • [VMWARE] Disconnect the CD-ROM for the guest OS when not in use (VM -> Settings -> CD-ROM -> Device status)
  • [VMWARE] Providing you have enough memory set VMware's memory to not swap (Edit -> Preferences -> Memory -> Fit all virtual memory into reserved host RAM)
  • [VMWARE] Disable snapshots (VM -> Settings -> Options -> Snapshots -> Disable snapshots
  • [GUEST] Make sure your virtual disk is set to use write caching in the guest OS (<DriveLetter> -> Properties -> Hardware -> <PhysicalDrive> -> Properties -> Policies -> Optimize for performance)
  • [GUEST] Disable all visual effects in the guest OS (eg. fade effect) (<Desktop> -> Properties -> Appearance -> Effects -> uncheck all)
  • [GUEST] Run the guest OS in full screen mode

Addendum

With the release of VMware Workstation 5.5.1, it is no longer possible to get clean VM shutdowns upon reboot or shutdown. When you instantiate a virtual machine under FireDaemon, vmware.exe is launched which in turn launches vmware-vmx.exe. vmware.exe and vmrun.exe (used to shutdown the VM) talk with vmware-vmx.exe via named pipes. During a reboot or shutdown Windows sends control messages to all processes advising that the machine is about to be rebooted or shutdown. vmware.exe processes and handles these messages correctly, vmware-vmx.exe does not and consequently hard exits leaving your VM in a crashed state. To get around this issue, use this batch script below to shut down your FireDaemon services in advance of reboot or shutdown. Place the batch script on your Desktop and double click it when you want to reboot or shutdown:

@echo off
echo Shutting down services ...
for /f %%x in ('"%FIREDAEMON%" -l') do net stop %%x
REM Use the line below to reboot
tsshutdn 0 /v /delay:0 /reboot
REM Use the line below to shutdown
tsshutdn 0 /v /delay:0 /powerdown