Saturday, December 08, 2007

Making a Deployable WinPE 2.0 boot DVD + WIM image file

OK, so you have been playing with both ImageX and WinPE 2.0.

You like WinPE 2.0 and you like ImageX.

Now you want to make your own standalone DVD boot disk, with system image.

Must be next to impossible. Right?


It's as easy as making a Reese's Peanut Butter Cup.  Smash the WinPE 2.0 and WIM file together and you have single-goodness!

You do need to do this in a few stages, however.

Stage One: Initial WinPE 2.0 boot disk creation

I suggest reading this previous post Windows PE 2.0 Free For Everyone (Almost) for a good overview of the process, if you aren't familiar with it.

1) download and install the WAIK on your XP or Vista system.

2) Follow these steps to create your WinPE 2.0 disk....building must be done on a NTFS formatted partition!)

a. Toss DOS, Install Vista with Free WinPE

Go to the Start menu and under All Programs find the Microsoft Windows AIK folder and launch Windows PE Tools Command Prompt, or open a command prompt and type

> cd c:\program files\Windows AIK\Tools\PETools.

b. Create a local Windows PE build directory by typing the command copype.cmd <arch> <destination>. If you’ll be working with 32-bit machines (the rest of the examples will assume you are), replace <arch> with x86. If you’ll be working with 64-bit machines, replace <arch> with either amd64 or ia64, depending on which chipset your computers have.

> Copype.cmd x86 c:\winpe_x86

c. You’ll see a list of files copying. When the copy is complete, you can add other tools to the image as well. One that you will likely want to have included is ImageX. To add this, if you installed WAIK to the default location, type (that is all one line).

> copy "c:\program files\Windows AIK\Tools\x86\imagex.exe" c:\winpe_x86\iso\

NOTE: ANY files you copy to this location will get burned to the ISO and appear at the root of the CD.  This is where you want to place any .WIM image files you create and want to store.

d. You can now create a .ISO image using the Oscdimg tool. Change to the PE Tools directory by typing

> cd c:\program files\Windows AIK\Tools\PETools\ and hit enter.

Then, type

> oscdimg -n -bc:\winpe_x86\ c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso (again, all one line).

e. With the image file created, you can now burn it to CD. (Save your DVD for next time.)

Stage Two: ImageX and drive captures / restores

Again, consider this post if you are not familiar with ImageX Grand Stream Dreams: ImageX - Welcome to the Imaging X-Zone.

1) Boot the system with your Win PE 2.0 boot disk.

2) I highly recommend you try using a portable external drive to capture the image.  Just be sure you have correctly identified what drive letter the device is mapped to. Win PE 2.0 seems to be very good about picking up and mounting USB storage devices.

3) To capture the image, type: imagex /capture c:\ e:\image.wim "image name"

You can leave add "/compress maximum" if you want the image at "normal" level or use "/compress fast" for a larger, but faster image capture process. Place it after right after the imagex command.

You must specify the specific full capture drive letter and path to where you want to put the image. I used "e:\" as my example, yours will differ.

You can also add the /check and/or /verify switches as well, though these will increase image capture times.

You can name the .wim file whatever you want.

The final part "image name" (with quotation marks) identifies this particular image file in the image.wim image file.  Does that make sense?  See, one .wim file can actually contain multiple images!  How cool is that?.

Stage Three: WinPE 2.0 boot + Image disk creation

Now we need to go back into the Stage One steps to build a new WinPE boot disk. However, this time, you will do a few things different.

a. Copy your captured "image.wim" file to the c:\winpe_x86\iso\ subfolder location.  Assuming you haven't done anything crazy, the imagex.exe utility file should still be there from last time.

b. Go to the Start menu and under All Programs find the Microsoft Windows AIK folder and launch Windows PE Tools Command Prompt, or open a command prompt and type

> cd c:\program files\Windows AIK\Tools\PETools.

NOTE:  Oscdimg Command-Line Options - Microsoft TechNet info on the Oscdimg command. This is the one used to build the ISO image file for the WinPE 2.0 disk you must make.  TIP: if you try to burn a DVD sized ISO with the normal instructions it will error out.  You must use the undocumented "-m" argument in your string to force it to build the ISO over the normal CD-sized ISO size.  Use the -m switch to override the creation of ISO images larger than 700 MB

c. You can now create a .ISO image using the Oscdimg tool. Change to the PE Tools directory by typing

> cd c:\program files\Windows AIK\Tools\PETools\ and hit enter.

d. Then, type

> oscdimg -n -h -m -bc:\winpe_x86\ c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso (again, all one line).

Why would this be important?

Well, if your imagex wim image is about 3.4 GB or less, you can now actually include it in the WinPE 2.0 ISO build process and have your image on the same DVD as your WinPE boot disk with ImageX.  Great time saver. 

e. With the image file created, you can now burn it to a DVD disk. (assuming that the combined file-size isn't larger than the DVD's storage capacity.)

Stage Four: Image Restoration

All this assumes that you will be working on a drive with a single partition.  You will have to adjust your steps if you are working on a multi-volume and/or multi-partitioned drive.

a . First you must be sure your target drive/partition is prepped.

Here is a "gotcha" for image deployments for ImageX. 

With Ghost, you (usually) just perform a disk-to-disk copy (all) or maybe a partition-to-partition copy and move on. You don't normally think about formatting the disk and/or the partitions.  With ImageX you must, as it overlays the image on the drive/partition.  If stuff is already there and not removed, the image overlays it and leave all the non-matching original remnants behind.

Likewise, you can't take a "naked" and unformatted drive/partition and just put the ImageX image back on it.

b. So, boot your target system with your Win PE 2.0 disk.

c. Either partition the drive accordingly (if "naked") or format the boot partition.

Assuming you have the bare-drive ready, create an active partition.  In the command-line interface start typing and press <enter> after each line (assuming you don't get any errors.

    • Diskpart
    • select disk 0
    • clean
    • create partition primary
    • select partition 1
    • active
    • assign letter = C
    • exit

What we have just done is ran the diskpart utility, selected the master drive (0), cleaned it, created a primary partition on it, selected it, set it to be the active (boot) volume, assigned letter "C" to it, and jumped out.

d. Now we just format the active partition that we created above. Type the following and <enter>

    • format C: /fs:ntfs /q /y

Now your drive is formatted with NTFS and ready to go.

Of course, the diskpart and format commands have a whole-lot more complexity than just this, but this is the quick and easy way to get a single partition ready to put an ImageX image on it.

I've seen several mentions that say a "/q" quick format will work fine, and others that say you must do a full format after creating it with diskpart. So far the /q "quick" format has been working fine for me.

e. Once your target drive and partition have been prepped, put the image back down.

f. Change directory over to where the imagex utility is and run the command, pointing to where the .WIM file is; your external USB drive (e:) or DVD disk media (d:). Your drive letter mappings may differ.

g. Run the following command: imagex /apply d:\image.wim 1 c:

You may want to add the extra option /verify at the end to verify your image laydown...just remember that that adds time to the deployment.

Note the "1" we used.  This means to use the 1st image in the .wim file.  If you have multiple images in a single .wim file you will need to know which "index number" image you want and use that number accordingly.  Also, I am using "image.wim" as the image's file name in my example. Yours may differ and needs to be changed accordingly. 

h. Once done, remove the Win PE 2.0 disk, reboot the system, and your new image should appear.


Welcome to GImageX - a GUI Front-End

GImageX is a freeware tool that places a GUI front-end on the command-line utility that ImageX is.

This makes it much easier for non command-line folks to use the tool to capture your WIM images, mount the images, and deploy the images.

Just be sure to copy GImageX.exe and the ImageX files (from WAIK) into the correct directory during your WinPE 2.0 building process. 


That way it will be ready to use. 

Then run GImageX and have at it!

More information and examples of WinPE 2.0 building:

Windows PE 2.0: a tiny version of Windows for system maintenance | APC Magazine

Creating a bootable WinPE 2.0 CD and/or USB Flash Drive – Svrops

More information and examples of ImageX usage:

The Lazy Admin : Capturing a custom Image using ImageX and a Generic WinPE Disk

Deploying Vista with Sysprep and Imagex - Svrops

PC Deployment with ImageX - O'REILLY WindowsDevCenter

HowTo: Using Windows PE 2.0 and Image X to deploy Windows XP Embedded - Brad Combs eMVP

Deploying A WIM Image With ImageX - User Suck blog

Shell Blog : Part 3 Dr. Unattend: Sysprep and ImageX or how to capture an image by its toe

The Lazy Admin : Capturing a custom Image using ImageX and a Generic WinPE Disk

Redmond | Column: The ImageX X-Files - Contains an ImageX cheat sheet.

Newsletter #61 February 2007 (ImageX and WIM files) - Mark Minasi's Windows Networking Tech Page

Happy Imaging.



Anonymous said...

Hi There,
I have read heaps of articals regarding making bootable Vista DvD but your article is very easy to understand and follow.Thanks Heaps for making such a wonderful document.
I have customised my wim and installed it on a Dell T3400 desktop with 3 SATA HD and 2 DVD burners but getting a error after first reboot winload.exe error any idea's.After repairing the installation with Vvista dvd i get my customised image back but i just donot want Vista DVD.

Thanks again for your post.

Anonymous said...

@ AM - Thank you for your kind words and appreciation. I'm glad you found the post helpful. I really like using ImageX for our imaging work and it is very flexible.

I just use it for XP Pro systems at the moment as we haven't progressed to Vista systems yet.

I did a bit of Google work (as I am sure have have done) on the winload.exe error. Looks like many folks who are using other imaging solutions are also running into this with Vista images.

I picked out these in particular:

Vista's MBR Disk Signature

Stories from the edge of sanity: winload.exe error when booting ...

I used to get that error in my VistaPE building sessions. Solution was to do my building in a folder that had full "Everyone" rights under the security settings. But that wasn't really an imaging issue per-se.

According to some of the other posts I've read, Vista seems to look closely at the MBR. If you are moving the image to a new system with different drive type that might be causing some kind of mis-match that running a Vista repair fixes.

I'm curious if you are using "Sysprep" to prep the Vista image before you deploy it to a different system?

I wonder if that might help? - Deploying Vista with Sysprep and Imagex

Comparing Windows XP and Windows Vista Deployment Technologies

Windows Vista Deployment Step-by-Step Guide

I always use Sysprep with our XP Pro deployments across systems, but again, since we haven't moved to Vista at work, I haven't worked with the Vista version yet. It might be worth looking into if you haven't yet.

Sysprep seems to fix a lot of cross-system image deployment issues.

Please let me know if you find anything that works!


Unknown said...

Just wanted to say thanks! I'm use to applying the .wim file to to a windows 7 directory on a flash drive, but now I have to image xp machines (no .wim files to replace there)

Thankfully, after scouring the internet for a few hours, I stumbled upon your tutorial and found out how to install the .wim file straight from the ImageX flash stick! Thanks again, awesome tutorial!