The latest Windows version supports the notion of booting from one big file—called a VHD file—that stores an entire C drive. It's a interesting technology, but to try it out, you need a VHD file that both contains an OS and is bootable. In the past year or so, I've examined some of the technologies and tools that make boot-from-VHD possible, and in this column, I'll bring some of them together so that you can assemble a bootable VHD file. (The cool thing about this column is that I'm not going to show you any new commands—just a new way to fit them all together into one big Windows power tool.)

Microsoft offers two paths to get a system into VHD-able state. I covered the first—Disk2VHD—a few months back. The second approach involves several steps and tools but might be the preferred (or sometimes the only) way to get from "working prototypic computer" to "bootable VHD."

You first need to set up a prototypic PC that meets your organization's needs, is outfitted with applications, has an appropriate default user profile, and so on. Then, run

sysprep /generalize /oobe /shutdown

on that prototype system, as I discussed several months ago. (You can also choose at the Sysprep stage to embed a file with initial startup instructions, but that's a discussion for another day.)

At this point, you have a system that's ready to be duplicated and rolled out to other systems—once you've used an imaging tool to capture the contents of its C drive, as you've done over the years with tools such as Symantec Ghost or Drive Image Pro. However, unlike the one-step deployment procedures you've used in the past, this task involves three steps: Boot the prototype system from Windows Preinstallation environment (WinPE), use ImageX to capture the system to a .wim file, use Diskpart to create a VHD large enough to hold Windows 7, attach the VHD as a drive letter, and use ImageX to apply the new .wim to the newly attached VHD.

Thus, your next task is to boot your Sysprep-prepared prototypic system with WinPE (via USB stick, CD, or whatever) so that your system is ready to run ImageX. You're going to image the C drive (which is probably fairly large), so you'll need somewhere to store the .wim file that ImageX will create. Anything will do, so long as it presents itself as a drive letter (e.g., an external USB drive, a mapped share). Also, sometimes WinPE re-letters the drives, so you might have to poke around to figure out which drive letter is the actual C drive on the Sysprepped system. Let's assume in this case the C drive is indeed the C drive and that you've hooked your system up to an external drive as drive S. The ImageX command to capture this system would look like

imageX /capture c: s:\baseimage.wim "Prototype desktop image" /verify

That command converts the C drive into a .wim file, checking with the /verify option that C's data got copied without any errors.

Next, you'll need a VHD that you can apply the .wim to. You'll use Diskpart to create, select, and attach a VHD on S, and then to partition and format it. In this example, I'll arbitrarily set its size to 100GB, as follows:

diskpart<br> create vdisk file=s:\vhds\deployimage.vhd maximum=100000<br> select vdisk file=s:\vhds\deployimage.vhd<br> attach vdisk<br> create partition primary<br> active<br> format fs=ntfs quick label="Standard image"<br> assign letter=t:<br> exit

I discussed the Create Partition, Active, Format, and Assign Letter commands last year, and I showed you the Create Vdisk, Select Vdisk, and Attach Vdisk commands a few months ago. This command gives the VHD a drive letter of T so that you can run ImageX and tell it to apply the .wim file that it just created to drive T, like so:

imagex /apply s:\baseimage.wim 1 t:\ /verify

Recall that ImageX needs the 1 to clarify which of the images in baseimage.wim to use. (As I've explained in past articles, .wim files can support multiple images.) Yes, there's only one image there, but ImageX needs things kept very, very clear. Again, the /verify option tells ImageX to take some extra time and ensure that the data copied without error. Finally, tell the system what you’re doing with drive T and to let you disconnect it:

diskpart<br> detach vdisk<br> exit

And with that, you've got your first bootable VHD. But how do you use it? Stay tuned!