At Inetium, virtualization is a fundamental part of our infrastructure. It allows us to create individual environments that mirror our client's production environments, keeps developers from interfering with one another's work, and uses our server hardware more efficiently than the 'one server, one environment' approach. Virtualization has been a big success but it has brought it's own set of management "opportunities." One of the challenges is to create and package tools so users who aren't server admins can perform routine maintenance on their virtual machines.
Because our hundred or so virtual machines aren't all members of the same domain, management tools such as SMS or Altiris, are challenging to apply. While I was pondering this challenge, I was also kicking around the question of how we ensure that the Virtual Machine Additions (VMA) are installed on each virtual machine. At some point, it occured to me that we could combine the methos of deploying VMA with the scripts and applications we want to make accessible to our users.
Although the Virtual Machine Additions get their own screens within Virtual Server, what's happening behind the scenes isn't very complex. The VMA installer comes prepackaged as an ISO image. When you check the box to install the VMA, Virtual Server attaches the ISO to the guest machine, as if you inserted a CD-ROM. As a part of Microsoft's Autorun technology, the guest's Windows OS looks for a file called autorun.inf that tells it what to do with the CD-ROM. In this case, the autorun file tells the server to run the application Windows\setup.exe. The setup program, of course, leads you through the process of installing the Additions.
This technique can be easily extended to other applications. All you need is a tool to create an ISO file from source files, rather than a source CD. The tool I found is an application called Magic ISO Maker. It has a Windows Explorer-like interface and allows you to drag and drop files into your new ISO. There's a lot of other functionality I haven't even tapped into yet. It's reasonably priced at $29.95.
Once you have an ISO maker, you simply move the files your application needs into an empty ISO image and create the proper autorun.inf file to automatically launch the installer. This MSDN link (http://msdn2.microsoft.com/en-us/library/aa969327.aspx ) lists all the acceptable parameters for the autorun file. The VMA ISO has one line: "OPEN=Windows\setup.exe" If the program you're launching is a Windows Installer-based package, you can pass along the usual command-line parameters, such as /qn for a quiet installation.
After creating the ISO file, move it into the directory %PROGRAMFILES%\Microsoft Virtual Server\Virtual Machine Additions. Virtual Server uses the Search Paths setting to enumerate ISOs in other directories, so you can create an alternate directory if space concerns or administrative policy prohibit you from putting them on the system drive. Make sure that NTFS permissions are set correctly so that only authorized users can create these software packages.
Once the file resides in a searchable directory, use the Virtual Server web interface to attach your ISO image to your virtual machine. As long as a user is logged into the machine and the autorun file is properly configured, your new deployment package will start running. (The one downfall of this method is that a user has to be logged in with the appropriate rights for the installer to run.)
There are a lot of ways we can use this method of deploying software. One of the ideas I'm currently working on is creating a script to clean excess junk off the virtual machine images. I also want to automate the process of defragging a disk, running the precompactor, and finally shrinking the drive. I've also modified the VMA ISO to eliminate any required interaction on the user's part.
In my next post, I'll show I used this technique, along with Microsoft's BGInfo, to create an install package to display the Virtual Server host machine's name within the guest machine.