Virtualizing Your Training Environment For Quick Restoration With VMware

February 15, 2008

by — Posted in Security, Technology

This was a persuasion piece I wrote for work on how to quicker deployments and restores in the training lab.   It seems we had employees several times a week had hours of their time taken up by reloading PC’s in the training rooms or in the testing labs.   I wrote up this piece which is unfortunately light on detail (if you have questions post them here I’ll answer) for management to look at what we could do to script this solution out.   Because of work security requirements I did make some modification to the information listed here, I kept the changes to a minimum though.  I actually will be doing a follow up ot this article which will contain the reload scripts and technical nitty gritty.  My idea has been at least going so far as to be tested (I have VMware workstation on my work PC now).




There are many good reasons for virtualizing your environment.  The two major reasons for this undertaking for this are to save money on cost or to save time on deployment operations.  Since most training labs will still require a computer for each student to learn on, our focus in moving to a virtualized architecture would be to save time for each setup and deployment.



Configuring the Images


The IT department will supply images for their current supported loads to the training the environment.  This virtual image will be created by VMware Workstation.   Since each machine has to be unique to the machine it is running and joined to the domain, the image will have to go through a one time Sysprep for the machine it is to be loaded on.  From the standpoint of any technician maintaining this environment the initial setup of the virtual machine would be the same as setting up any other machine in the environment.


  • Each virtual machine though built from a standard base image must be unique to the machine it is installed on
  • Each virtual machine’s computer name will be the ComputerName+v+OS version so the name would be ComputernameVXP for a standard XP domain image.   The tag number for the vista machine would be ComputernameVVIS for Vista.  A similar naming convention will be used on each machine and for each operating system installed as virtual machine.


 This deployment is starting with Windows based operating systems but can be expanded to support any operating system that is able to be virtualized.


Preparing the Host PC


The computer the virtual machine is installed on is considered the host machine.   This terminology is used to reflect that it is hosting the virtual machine.   This machine will be loaded with the standard supported operating system in the environment (Windows XP at the time of this writing) that is locked down.   Via computer and group policy the only options the students should be able to perform within the host’s local PC environment is the ability to log off the host computer and to click the desktop icon to run the virtual machine.


In the root directory we will create some a new directory called c:\images underneath here there will be two directories, c:\images\run and c:\images\archive.  In the run directory will be the current live image on the system, the backup and “clean” image will be stored in the archive directory.  On each machine the c:\images directory will be shared allowing only access to domain administrators, helpdesk, and the teacher’s computer.


When these steps have been accomplished a technician will copy an image from the reference share created on the network and copy it to the c:\images\archive directory.   The image MUST be set to be read-only. The technician will install VMware Player on the host machine.   After VMware Player is installed associate the .vmdk image file in the reference directory with VMware player.   Load up the image you want to adjust (the one you pulled down form the reference share and start it in VMware player. 


The image will load up ready for patches and the overlay script.    Deploying it uniquely to each machine in this state will ensure it will have the latest overlay and settings that are required at the time this is being deployed on the host machine. Follow the naming conventions for virtual machines and join the virtual machine to the domain.


When new virtual machines are being deployed inform the architecture team so they can be joined into the appropriate domain group for training computers.   This goes for the host as well as the virtual machines.   Since there needs to special policies applied to the host, this step is very important.


When this step has been completed configuration of the host machine should be complete.   There will be no need to monitor normal day to day activity or reload of the machine since this will all be handled through the virtual machine.


Setting up the Teachers/Management Station


The teachers computer will have VMware player installed with the same images as the users.  The host operating system however will not be locked down as far as the student’s host machines.  On the teaching station the installation technician will create a c:\scripts directory which will include the maintenance scripts for the local training environment.   While there will be reference scripts available on the same share the reference image can be pulled from, these scripts will have to be modified to include all the student machines in the local training area.   For the scripts to complete successfully all the student computers that are going to be in use must be turned on.


The first script will copy the image the teacher wants to train in the environment from the c:\images\archive directory to the run directory.  This is designed for easy maintenance and clean ups of the machines.   Since the students will only be working on images in the run directory we can still have a backup that is “clean”.  This script will also copy a shortcut to launch the machine onto the student computer’s local desktop.   Optionally the script could copy this shortcut into the students “start-up” folder so the virtual machine is auto loaded when the student logs into their host computer.


The second script created will be the cleanup script.  This script will go out to each client computer that was used and delete the image in the run directory and copy the new default image from the archive directory and place it in the run directory.  This is to make sure that if the teacher doesn’t run the first script that the client PC’s have the default image available to them at startup.   This script will not change the shortcuts on the user’s desktop.

If the trainer uses software that is outside of the scope of a normal load, images that utilize different software configurations can be saved.   For the trainer to do this they can contact local IT support to have this completed.  To create new images activate the script that puts a new machine in the run directory of the client computer.  At this point the following steps must be taken:


  • Open up the image that is located on each clients run directory
  • Install the software that is special to this configuration
  • Shut down image and exit it out of  VMware Player
  • Rename the image so it denotes what is special about it
  • Copy image to the archive directory
  • Contact IT support to modify the maintenance scripts


The original base image for the student host machine has been set to read-only this should help prevent the original base image form being accidentally overwritten.





On the last Friday of the month the base image of each machine must be refreshed.  This is to limit the amount of time it takes to patch the image each time it is run after being reset.  Here is what that entails:


  • Set the attribute of the base image so it’s no longer read-only
  • Open up the base image and let it startup
  • Login to the virtual machine
  • Open up the run option from the start menu and type “wuauclt /detectnow”
  • Wait a few minutes to make sure all the windows update patches are pulled down – it is recommended you start the next virtual machine before moving to the next step
  • At this point allow the virtual machine to reboot
  • Wait for the machine to reboot to makes sure it starts up without any errors.
  • Login to the virtual and makes sure it loads correctly
  • Shutdown the virtual machine.
  • Reset the base image to be read-only


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.