Geeks With Blogs
David Douglass .NET on My Mind

One of the things you can do with Microsoft Virtual PC is create a standard developer workstation image, an image everybody on the team uses to develop a particular project.  There are several advantages to this:

  • Environments don't become corrupted because they're trying to do multiple things
  • If you create an image for each release you're maintaining, you reduce the risk of mixing code from multiple releases
  • Only one person has to build the image
  • Everybody's development environment is identical
  • You can quickly add developers simply by handing them the image
  • If somebody's environment becomes defective you can simply replace the image

The way to do this is to prepare an image that contains a fully patched OS and whatever else you need to develop, such as Visual Studio, SQL Server, etc.  Also, consider putting these free downloads into your image:

You'll probably also want to reset some of the Windows home user oriented things (such as not displaying known file extensions).

Once the image is just so, you need to seal it using SysPrep.  You can get SysPrep from the Microsoft Download Center by searching for "Deployment Tools".  Look for downloads that have "deployment tools" in the title.  Check carefully when you download because each operating system and service pack has a unique download.

Sealing allows you to copy the image.  If you copy the image (and use it) without first sealing it, you'll wind up with 2 computers (even though they're virtual) with identical security identifiers.  This isn't a minor issue; expect problems with the Microsoft Distributed Transaction Coordinator if you copy and boot images that haven't been sys prepped.   Mitch Tulloch, a great Windows author, has a tutorial covering creating and sealing an image.

And now the fun begins.  SysPrep has a serious bug.  When you boot the sealed image, Windows goes through much of the boot process and then tells you "The system is not fully installed. Please run setup again.".  Acknowledging the dialog box causes a reboot, and now you're in an endless loop with this.

Knowledge base article 320279 is an exemplar of bad writing.  It has a section entitled "Steps to Reproduce the Behavior".  That's the first of two solutions presented.  Then there's a section starting with "To work around this issue".  That's the second solution.  Of course, you get the impression there's only one solution, which is to load a second operating system.  Both solutions have the same objective: to edit the registry of the system that won't boot to completion.

Not wanting to install another operating system, I edited the registry using ERD Commander 2005.  This awesome tool allows you to edit the registry on a dead system (and a whole lot more).  Another way to edit the registry, when using virtual machines, is to mount the virtual hard disk of the defective system as a secondary drive on a virtual machine that works.

Microsoft claims the problem is with \\HKEY_LOCAL_MACHINE\SYSTEM\SETUP\SystemSetupInProgress being set to 1 instead of 0.  So I reset it to 0 and rebooted.  This got rid of the dialog box and allowed me to log in, but the boot didn't run to completion.  Most of the services marked for automatic startup weren't started.  Also, the "mini setup", the wizard you get when you boot a system for the first time, didn't run, which should have since the system was sealed.

So I threw out my bad image and created another one from scratch, always backing it up prior to sys prepping.  After enough googling, I finally got a hint that the trouble maker was Windows Media Player 11.  I uninstalled WMP 11 from my master and that did it!  After sys prepping it rebooted perfectly.

When googling, never forget to look in news groups.  That's a separate search from the typical web search.  Web searching didn't reveal the WMP 11 problem; I found it in the news groups.

Another thing I've learned in all of this is that Visual Studio 2005 Service Pack 1 is not virtual machine friendly.  When you use Virtual PC dynamic disks, you often don't have much free disk space.  Normally, this doesn't matter because Virtual PC will grow the disk as necessary.  But the service pack refuses to load, thinking you don't have enough disk space.  I tried to manually grow the disk using VHD Resizer, but that created another partition.  When I tried to expand the operating system partition (which is where I needed the space), I ran into "Diskpart failed to extend the volume. Please make sure the volume is valid for extending.".  In other words, what I was trying to do isn't supported.  I got around the problem when I created my second master (see above) by using a 20 GB Virtual PC fixed size disk.

But, the image I'm creating is for distribution, so the 20 GB size isn't really acceptable.  To reduce the size I went through the following transformations:

State Size (GB)
initial fixed disk 20.480
converted to dynamic disk 13.682
compact using Invirtus VM Optimizer and the Virtual PC Virtual Disk Wizard 8.854
sealed using SysPrep 8.860
zipped 4.981

I picked up the Invirtus VM Optimizer based on recommendations from Scott Hanselman and Jeff Atwood.  VM Optimizer removes files you don't need and performs some sort of magic that causes the resulting compacted image to be smaller.  If I compact the 13.682 GB dynamic disk without first applying VM Optimizer, I get nothing; the file size is still 13.682 GB!  The Hanselman and Atwood posts above contain a lot of interesting stuff; definitely read them.

One downside of VM Optimizer is that removing files you don't need is too aggressive.  Unfortunately, some of those files are used during the mini-setup that occurs after a sys prep.  The only problems I noted were cosmetic; missing background images and button images; but it does make you wonder what else is missing.  VM Optimizer does allows you to choose which types of files to delete, but it isn't clear which option causes the mini-setup files to be deleted.

Posted on Sunday, April 29, 2007 1:32 PM | Back to top

Comments on this post: Learnings from Creating a Developer Virtual PC Image

# re: Learnings from Creating a Developer Virtual PC Image
Requesting Gravatar...
Many thanks for the details of WMP11 and Sysprep issues - I'd have been searching for the solution to this problem for many hours without your post! :-)
Left by Richard Tubb on May 28, 2007 1:07 PM

# re: Learnings from Creating a Developer Virtual PC Image
Requesting Gravatar...
Thanks for sharing our experience about this topic. I'll be making a master image for ordinary workstations from VPC, and with your article I think it points to the right direction.
Left by xenox on Jul 02, 2009 8:37 PM

# thanks for the post
Requesting Gravatar...
Keep posting stuff like this i really like it
Left by pharmacy tech on Mar 10, 2010 12:38 PM

# re: Learnings from Creating a Developer Virtual PC Image
Requesting Gravatar...
great resources, thanks for the links it's quite handy :)
Left by hair removal on Dec 13, 2010 12:42 PM

Your comment:
 (will show your gravatar)

Copyright © David Douglass | Powered by: