If you're hardcore and know your way around a PC, then you can skip the introduction, as it is aimed as less savvy users (like myself) who need some background.
The aim here is to create a disaster recovery disc (or image on an external drive, thumb drive, etc.) that can be used to restore Windows Vista in the event that your system suffers a total meltdown. This process will take you a couple of hours to complete, but it will be well worth it the first time that you are hit with a virus or your system hard disk croaks.
Those who spent the money on Vista Business or Vista Ultimate have another, easier option at their disposal. Although, truth be told, the process outlined herein is more reliable and flexible (see section 10 for ideas on how to extend the usefulness of this process). Owners of the above-mentioned Vista types have access to the Complete PC Backup tool, which is only included in those two verisons. The Complete PC Backup tool produces a series of XML, catalog, and data files that can be burned to optical media (or stored on virtually any device) and restored rather quickly (using the Windows Recovery Environment that is included on all Vista installation DVDs), but I was looking for an option that would be available to ALL users of Windows Vista, since I believe that this feature should come standard and be easy to use. Since Microsoft failed to meet either of those expectations, my intention is to fill-in some of the gaps.
For as much as many of us hate Microsoft, they did provide a manner by which ambitious users could disaster-proof their precious, customized Vista installations. All individuals -- legitimate Windows Vista licensees and otherwise -- have access to the WinPE tool set. Whatever your particular situation, take the opportunity and put it to good use.
Given that you've probably sought-out this tutorial, you have already found a reason to create an image of your installation. If you're curious but haven't found a reason to image your installation, I'll give you several. We've all experienced a computer crash, whether it was because we were fiddling with partitions, downloading smut, hoarding "warez", or simply the victims of shoddy software/hardware. There's nothing worse than experiencing a bad computer crash and then having to sit through an hour-plus Vista re-installation. Hopefully, you'll be able to find your Vista product key, and even if you have it handy, you'll have to key-in all 25 letters. Worse yet, you will have to customize everything to your taste all over again, download all of your favorite programs again, change the location of the My Documents folder, or whatever else you do to tweak your Windows environment. You'll also have to re-download hundreds of Vista updates (many of which you dubiously marked as "hidden" the last trip around, I'm sure) and jump through all of the hoops. Have I convinced you, yet? Great. We're going to examine a solution that allows you to get everything set-up just the way you like it (all of your commonly-used programs, custom Firefox profiles, whatever) and then immortalize your "perfect, pristine installation" and ensure that it can be used to restore your system to its perfect state when (notice the lack of an "if/and") a major problem arises.
I enjoy building PCs for friends and family, and anyone who has ever undertaken that challenge knows how easily one's good name is tarnished following a first-week-of-use burn-out on the girlfriend's (or boyfriend's) mother's laptop. And, of course, most people don't spring for the $300-$400 version of Vista (with good reason, as I shall seek to demonstrate), so we lack the Complete PC Backup option that comes standard with the pricier Vista flavors. Fortunately, there is a relatively easy way to have her back up-and-running in, quite literally, a few minutes, even on Vista Home Basic. You'll be a regular, home-town hero with this skill.
If chicks aren't sufficient to pique your interest, maybe saving yourself several hours of hassle, as a learning, PC-enthusiast will be. In either case, before we get started, let's understand exactly what we're doing here.
Microsoft makes available (to any interested party and free of charge, amazingly) something called the Automated Installation Kit. This Kit is new with Vista, probably because the old 2K/XP deployment method was horribly antiquated. The Kit (which is backward-compatible, by the way, meaning you can use it to deploy XP/2003, with some limitations [you can't edit images for OS's prior to Vista]) is designed for "IT Professionals" who manage enormous fleets of computers (or manufacture PCs), and is intended to give those individuals a means by which to deploy Windows Vista on thousands of computers, simultaneously (through multicast network deployment, that is, one "master" image being sent to thousands of recipient hard disks at once). It used to be that Windows installations, right up until Vista, inherited certain properties that were specific to the PC on which the operating system was installed. In other words, if you had installed Windows XP on your AlienWare gaming rig and then had to hock it for pot money, only to be relegated to an old laptop, there was no way to clone your hard disk and avoid reinstalling everything. This would only work if both hard disks were in virtually identical machines (same motherboards, same CPUs).
Well, with the new Microsoft imaging format, those days are gone. Theoretically, one can create a "master installation image" that can dynamically adapt to any target PC upon deployment (installation). What's more is that .wim images can be mounted, modified, and "saved" after changes are made. (Those with "permanently activated" copies of Windows, and who like to share with friends and dorm-room buddies, may be squealing with glee; yes, you can fully-customize installations, install whatever software you wish, and deploy the images to any machine you choose.) That is beyond the scope of this particular article, but you'll learn how to exploit the kit (if we can even call it exploitation, since this ability is rightfully owed to us) to create a very viable little recovery solution.
Not only can we use this kit, as average end-users, to create disaster recovery solutions, but it can be used to harness much more powerful aspects of the new WIM (Windows Image) format that Vista employs, as I've outlined above. If you find this tutorial useful, have a look at step 10 for additional variations that may suit your interests.
O'REILLY has a pretty detailed ImageX article that can be found here. Reading it is not a requirement, but it couldn't hurt:
a. A computer that supports the requirements for installing the Microsoft Windows Vista Automated Installation Kit (AIK) (see the link to the AIK, in step 1, below, for the requirements).
b. A CD (or DVD) burner that is attached to the computer mentioned above.
c. A basic understanding of drive/volume letters/labeling, simple DOS commands (though, I spell-out most of them), disk partitioning, external storage devices, CD/DVD burning, disc/partition images/imaging. (You can Internet-search for and read-up on any topics you don't understand.)
d. This tutorial assumes that you have a functional Vista-or-later PC at your immediate disposal. Further, this tutorial assumes that you intend to perform a fresh Vista installation on a new machine (a different machine than the one you're using to complete the first half of this tutorial). Of course, you can install Vista first, and then follow the rest of the tutorial, but if you do, you will probably want to uninstall the AIK (see step 1) after you burn your WinPE CD and before you create a .wim image of your pristine Vista installation (because the Kit itself will consume some space within your image).
1.) Download the AIK from Microsoft
Download the Windows Automated Installation Kit (AIK) from:
This page took quite some time to load, and thus never presented me with a download dialog. The following, direct URL can be be used in such a case:
2.) Mount the AIK disc image and install the AIK
Use an image-mounting utility to mount the .img image that you just downloaded. This will save you the trouble of wasting a DVD to burn the AIK. Personally, I prefer to use Daemon Tools, which can be downloaded for free from:
If you are unfamiliar with DaemonTools, consult the Daemon Tools documentation for more information on how to mount CD/DVD images. (Note: Daemon Tools will not look for .img files, by default, when browsing for an image file to mount; you must change the file type-dropdown in the "Select new image file" dialog within Daemon Tools to be able to see the .img file you downloaded.)
Install the Microsoft AIK. Once installation has completely, successfully, proceed.
3.) Create a bootable WinPE disc
These directions were taken directly from the Microsoft "GETTING_STARTED_ITPRO.RTF" document that is supplied with the AIK. I have made slight formatting changes to correct a problem with the original document (which caused problems for those copy-pasting from one of the below code samples) and added the terminal indicator ($) for the sake of clarity. Of course, do not include the $ when issuing your commands within the command prompt/terminal window. Copyright Microsoft, 2006.
--------------- BEGIN OFFICIAL MICROSOFT CONTENT ---------------
To create bootable WinPE media
In this step, you will create a bootable Windows PE RAM CD. You will use this CD to capture an image of your master computer and later deploy that image onto your destination computer.
From your technician computer, run the copype.cmd script to create a local Windows PE build directory. For example, from a command prompt, type:
$ cd Program Files\Windows AIK\Tools\PETools\ $ copype.cmd <arch> <destination>
Where <arch> can be x86, amd64, or ia64 and <destination> is a path to local directory. For example,
$ copype.cmd x86 c:\winpe_x86
Copy additional tools like ImageX into your Windows PE build directory. For example,
$ copy "C:\Program Files\Windows AIK\Tools\x86\ImageX.exe" C:\winpe_x86\iso\
(Editor's note: you can manually copy/paste files to this location if you are using a graphical environment [i.e., you are using a fully-functional Vista installation and not a command-line-only environment]).
Optionally, create a configuration file called wimscript.ini using any text editor, for example Notepad. The configuration file will instruct ImageX to exclude certain files during the capture operation. For example,
[ExclusionList] ntfs.log hiberfil.sys pagefile.sys "System Volume Information" RECYCLER Windows\CSC [CompressionExclusionList] *.mp3 *.zip *.cab \WINDOWS\inf\*.pnf
Save the configuration file to the same location as ImageX as specified in the previous step. For example:
ImageX will automatically detect wimscript.ini if located in the same location.
Create an image (.iso) file by using the Oscdimg tool. For example, from a command prompt, type:
$ cd program files\Windows AIK\Tools\PETools\ $ oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso
Burn the image (winpe_x86.iso) to a CD-ROM.
Windows AIK does not include CD-ROM burning software. Use any third-party software to burn the image to a CD-ROM. (Editor's note: Nero Burning ROM, PowerISO, MagicISO, DiscJuggler, Alcohol 120%, the Roxio suite, and a great many other programs can burn ISO images.)
You now have a bootable Windows PE RAM CD with ImageX. For more information on customizing Windows PE, see the Windows Preinstallation Environment (Windows PE) Userís Guide (Winpe.chm).
--------------- END OFFICIAL MICROSOFT CONTENT ---------------
4.) Install Vista to your taste on a new box, tweak away
Now that you have your very own WinPE 2 bootable CD, we're ready to move onto the next step.
Reboot your PC and insert your Windows Vista installation DVD. Ensure that the computer boots from the Vista installation DVD in the drive. (Note: You may need to alter your computer's boot device order, such that the CD/DVD drive is examined for bootable media before the hard disk is examined for bootable tracks; most PCs display "Press any key to boot from CD..." when the boot order is properly configured for booting from CD/DVD.)
Install Windows Vista (whichever flavor you happen to have) on the PC to be imaged (and therefore prepared for disaster recovery). I will note here that you will have to invest some thought into how you intend to partition your hard disk. Usually, I use the disk utility that is built into the Vista installer (you have to click on the "Advanced" link on the screen that asks you to choose the destination disk, during the installation process). One idea would be to create a small partition for the system volume (20GB should be sufficient for most individuals) and then create another, larger partition for your important documents and files; it's always a good idea to keep anything important away from the system partition, in case you suffer a catastrophic crash (frequent in Windows). Remember, too, that we are creating a volume image that will overwrite everything on the partition to which it is applied in the even of a disaster, so your system volume (usually C:) will be completely wiped and re-imaged. If you choose a similar set-up, you can store the .wim image on the second partition with your important documents and files, but, as always, ensure that you have a back-up on an external device of some kind.
Feel free to customize any and every aspect of your Vista installation to your liking. Remember, however, that the more you add to your installation, the larger the .wim (Windows Image) file will be. If you are hoping to fit the .wim file on one single-layer DVD, then you may want to keep the installation slim and cutomize only the essentials. (As a point of note, ImageX boasts approximately a 300% compression ratio when using the "fast" compression flag [explained later]. In other words, a 6.5GB Vista installation creates a 2.2GB .wim image; the image will be even smaller if you use the "maximum" option.) On the other hand, WinPE supports networking (assuming network drivers are automatically installed for your particular hardware), so you could save the .wim image to a network share, a USB thumb-drive, an external hard disk, or what have you. Note, also, that you can indeed split .wim images over multiple files of a specified size; consult the O'REILLY article to which I link at the end of the Introduction for specific command-line parameters used to split images.
When you're happy with your Vista installation, reboot the PC and insert the WinPE disc that we created in steps 1-3.
5.) Boot from the WinPE CD and create a .wim image of the fresh installation
The WinPE environment will load (if you did everything correctly) and present you with a command prompt. Familiarize yourself with the drive letters that Windows has assigned to your drives (this will depend on how many partitions you have and how many external storage devices are attached).
Essentially, you should be looking for the CD/DVD drive that contains the WinPE disc (mine happens to be labeled E:) and, of course, the drive letter for the device to which you intend to save the .wim image file. I'm going to save mine to another partition on the same physical volume, which WinPE has decided to label D:. Issue the follwing commands, but be sure to replace E: with whatever drive letter has been assigned to the CD/DVD drive in which the WinPE media is inserted. (Note: If you intend to save the .wim image to a network location, you may want to consult the "GETTING_STARTED_ITPRO.RTF" document to which I referred earlier; it contains network examples [among many other very useful examples for enthusiasts]. If you intend to burn the .wim image directly to a DVD, then you're on your own; I didn't research burning directly to DVD in this context. Of course, if you have somewhere that you can temporarily store the image [or its many parts, if too large for one DVD], you can use your favorite burning program [even the one built into Vista] to burn the files to disc once imaging is complete. To wit, there are several advantages of NOT splitting a larger- than-one-DVD image at creation time, which are explained in the O'REILLY article to which I link at the end of the Introduction.)
Also, there are many operators and flags that can be used. What I demonstrate below is probably fine for most users. Optionally, you can replace "fast" with "maximum" (this option sets the compression level), if you are intending to store the .wim image on optical media (a DVD, perhaps) and need all the compression you can get. Keep in mind that if you want to create an image that can be restored in the shortest time possible (and storage space [or network bandwidth, if saving to a network share] is of no concern), then don't compress the image (use the "none" value) and ensure that there is sufficient free disk space at the target location (which is, in my example, on the D: drive). Of course, you will replace "Gateway Laptop Pristine Vista" with a descriptive name that is to your liking. Lastly, you will notice that I have chosen to image C:, and unless you installed Vista to a drive other than C:, don't change that value. This process will take about 30 minutes for a typical Vista installation on a lousy laptop, so go grab a beer while you wait for the process to complete. (Or, if you're like me, grab a whole six-pack.)
$ E: $ ImageX /compress fast /capture C: D:\myimage.wim "Gateway Laptop Pristine Vista" /verify
(Note: If you receive an error, such as "'ImageX' is not recognized as an internal or external command, operable program or batch file.", then you have either used the wrong drive letter to access the WinPE disc, you have ejected the WinPE disc prematurely, or you forgot to copy the ImageX.exe file during sub-step 2 in step step 3.) above.)
6.) Restart the PC once imaging is complete
Once the imaging process is complete, we're done here. You can remove the WinPE disc from the drive and reboot the machine (just close the command prompt window; the PC will reboot).
7.) Confirm reboot success, burn the .wim (if desired), reboot again
Your machine should boot right back up into Windows, but let's confirm this before we proceed. Good. If you prefer to burn the .wim image to a DVD, go ahead; it should be saved to whatever location you specified in step 5.). You may also wish to change your desktop wallpaper or create a simple text file on the desktop. We take this measure so we can be sure that the image restore actually did something (instead of dumped all the data into a bottomless buffer somewhere), in which case you should see the original wallpaper after the restore process is complete.
8.) Make sure the .wim file was saved properly
Next, we'll test the .wim image we just created, because if it doesn't work properly, we'd rather know about now than when disaster strikes (or your blackout-drunk slob of a husband takes a squirt in the back of the PC tower after a three-day bender).
Make sure that you know where the .wim image is saved. If you followed my example, exactly, your .wim image would be located at D:\myimage.wim. We'll need to know this when we test the restore process in a moment.
9.) Reboot to WinPE, again, and test the .wim image file
Reboot your PC and load the WinPE environment from your handy WinPE CD. You'll see the same thing you saw in step 5.). Again, you may wish to familiarize yourself with your drive letters before proceeding, because if you apply the image to the wrong drive/partition, you could have a problem on your hands.
$ E: $ ImageX /apply D:\myimage.wim 1 C:
The 1 represents the image file to be used (since .wim files can contain several, separate images). In our example, you will use the number 1, too. Of course, don't forget to substitute the proper paths and drive letters that apply to your particular setup.
This process will take about 10 minutes to complete (at least on my crummy laptop). Depending on which version of WinPE/ImageX you are using, you may see hundreds of "SACL is going away" type messages. Ignore them. Apparently, there is no way to be rid of them ( http://forums.microsoft.com/TechNet/ShowPo...0&SiteID=17 ), anyway.
Hopefully, everything went smoothly, because I'm out of ideas if something screwed-up. "It worked fine for me!"
You should see "Successfully applied image."
That's it. See the next section for some ideas as to how you could extend these principles to create an even more useful restoration disc.
10.) Extending the usefulness of WinPE and ImageX for disaster recovery purposes
You may be thinking, "Wait... I bet I could combine the WinPE disc and my .wim file into one disc! Then, I could just boot and restore from the same DVD!"
Yep, exactly. While you can boot from a WinPE 2 disc and remove the disc to access files on other media (because the entire OS is loaded into RAM, thus it does not require the disc to be in the drive once loaded), this is not always ideal. Perhaps you wish to keep everything on a single disc for the sake of organization. If you look back at section 3.2 (step 2 of the official Microsoft documentation), you can copy any number of files of your choosing to your WinPE image before you burn the ISO file to a DVD. (As an aside, you can modify ISO files with a tool like MagicISO or PowerISO, and then re-save them, too, usually without destroying their booting capabilities.) As a result, you can throw the .wim image you just created into a new WinPE image and then burn the whole package to a single DVD. You could even include your favorite utilities and programs, so you aren't forced to bake them into your customized Vista installation (since by the next time you have to restore the PC, newer versions will likely be out, in which case you can just recreate your WinPE DVD to taste).
Another nice feature of the WIM image format is that a single image file can contain multiple volume/partition images. Better still, the WIM format supports an interesting (but commonsensical) feature that uses symbolic linking to reduce data redundancy. In other words, if you create one image that is a perfect, pristine Vista installation with absolutely nothing beyond the defaults installed, and then you create a further-customized version and re-image, you can actually combine the two images and all of the files that are identical across both images will only be included once in the final image file. This is precisely how Vista itself is distributed; all Vista installation DVDs are identical and the product key is what determines which features are installed. This is possible due to this symbolic linking. To put it all together, you can create a "pristine-pristine" image that contains nothing extra (may be good to use once a year to install the latest versions of software/drivers, out-of-the-box, etc.) and then you can create an "if my PC crashes in the next three months" image that is a more customized extension of the first image, and merge the two. In all likelihood, both versions would fit on a single DVD, since most of the files are the same and will only be included once. Of course, it's probably a good idea to hang onto the original "pristine-pristine" image, so you can always use it to create further-customized images every few months, on a repeating cycle.
Edited by Benny Bolas, 02 September 2007 - 06:34 AM.