Heres an example of how its done.
All Credit to RiboFlavin over on te OCZ forum
Quick and dirty guide to create PE boot key and capture/apply images using imagex
Some Prerequisites:
* Microsoft WAIK (Vista or Win7 beta are both fine)
* 256MB or larger USB key
Prepare the USB drive
From the machine that you installed the Windows AIK go to the start menu and select "Windows PE Tools Command Prompt" from under the Windows AIK program folder.
In the CMD window that appears type one of the following commands, ignore anything in ( ) as it is just an explanation of the command:
diskpart (launches you into diskpart)
list disk (will echo a list of disks found by diskpart - make note of which # disk is the USB disk)
sel disk 1 (this assumes 1 is the USB drive, replace with the correct number if it is different)
clean (DESTRUCTIVE ACTION!! this will erase the selected disk, partitoin table, etc. very important you have selected the correct disk number here)
cre part pri (creates a primary partition)
sel part 1 (selectes the just created partiton)
active (set the drive to eligible as a boot disk)
format fs ntfs quick (be sure to include the quick flag or it will take ages)
assign letter=J (replace J with whatever letter you would like windows to see the drive as - I'll be using J in my examples below)
exit
Prepare PE files:
From the machine that you installed the Windows AIK go to the start menu and select "Windows PE Tools Command Prompt" from under the Windows AIK program folder.
In the CMD window that appears type one of the following commands:
For 32bit OS Installs:
"copype.cmd x86 c:\winpe_x86"
For 64bit OS Installs:
"copype.cmd amd64 c:\winpe_amd64"
There is support for IA processors as well...but I'll let you figure the syntax for that one out.
Copy PE to the USB device:
Once the script is done processing, the working directory will be set to the path of the PE files that were copied to your local drive. Assuming J: is your prepped USB drive, issue the following command:
xcopy c:\winpe_x86\iso\*.* /s /e /f J:\
Obviously the characters in red need to match the path you choose when you ran the copype command and what the letter of your USB drive is.
Congrats, you now have a bootable USB key containing Win PE. I'll might bother to type up another guide that delves into the environment and cover some of it's many uses, but for now I'll stick to the matter at hand - capturing and applying WIM images.
ImageX and YOU
Although sometimes compared to the popular Symantec Ghost toolset, ImageX has several fundamental differences that, in some instances, make it a far superior product for capturing and applying OS images.
Just a few notes about ImageX
* ImageX captures images to a file called a WIM (windows imaging)
* ImageX is free and included in the WAIK you should have already downloaded and installed
* ImageX is a file based imaging product whereas Ghost is a sector based product. This means that ImageX will capture the data of the path you ask it to and ignore things like the MBR or how the disk / partiton was formatted, etc.
* ImageX is a non-destructive imaging prodcut. This means you can literally apply a WIM onto a drive and leave the existing data intact. This has huge advantages that I won't get into just yet.
* ImageX has the ability to intelligently (and via a configuration file) ignore the capture of trash data (temp files, pagefile, etc) when creating a WIM
* ImageX can store multiple images within a single WIM (each image is called a partition within the WIM). This enables you to store multiple versions of an OS image without space penalties - specifically, because images are so similar, ImageX will only capture what is different from an existing partition within the WIM and not store the same file more than once. I cannot begin to explain how kickass this is in testing environments. Think VMWare snapshot type space savings.
Capture a WIM using ImageX:
First, you will need to know what drive/directory you wish to capture. Normally this would be something like C:\ - but understand that you are free to capture anything you want - for example, c:\myjunkfolder\. However, for the purposes of this guide, I am going to assume C: is the drive we want to make an image of. Since the USB key I use is 32GB, I am going to save my WIM to this device (which was assigned a letter of E: in PE). You cannot save the WIM file to the same path you are actively capturing.
capture syntax:
IMAGEX [FLAGS] /CAPTURE image_path image_file "image_name" ["description"]
example syntax:
imagex.exe /capture C: E:\images\XP\XP_SP2_Build.WIM "XPSP2 CORE" "no SSD tweaks applied yet"
There are additional options, such as compression and verification that you can enable - but in order to keep this short I have left this information out as it is not essential.
Preparing the disk to apply a WIM:
I know this is repetitive, but remember that ImageX is a file system imaging product. This means several things, firstly, before a WIM is applied you need to ensure that the drive you intent to write it to has been formatted with an appropriate file system. This is easily accomplished with diskpart using the same instructions provided for making a PE USB drive or ideally - follow the guides to creating an aligned partition within this forum.
Apply a WIM using ImageX:
Now that you have created your WIM file, prepared your drive (aligned partition, formatted, assigned, etc) you can apply the captured WIM to the drive. Syntax for apply is similar to capture, just backwards and with an index to indicate the WIM partition to load.
apply syntax:
IMAGEX [FLAGS] /APPLY image_file image_index apply_path
example syntax:
imagex.exe /apply E:\images\XP\XP_SP2_Build.WIM 1 C:
the index number (in this example represented by 1) is there to tell imagex which index within the WIM to use. If you don't know what I am talking about and have only made one WIM file - then just use 1 by default. those that know what I am talking about probably don't need this guide anyways! It is worth mentioning that if you use imagex to capture/apply images of your PE environment, then you should also use the /boot flag to ensure the newly applied environment is still bootable.
Secondly, applying a WIM to your drive will not be enough to get the PC booting up into the OS. Once you have applied the WIM you will need to set the bootable OS using bcdedit.
For Vista:
bcdedit.exe /set {default} osdevice "partition=c:"
bcdedit.exe /set {default} device "partition=c:"
For XP:
bcdedit.exe /default {ntldr}
YMMV of course. These instructions should work fine for most people, but I cannot guarantee that your installation / WIM of XP / Vista is consistent with the information provided here. If anyone cares to follow this guide and needs some support, just post away with your info/issue and I'll be around to help.