Here is the demonstration steps from my presentation at Microsoft TechEd NA 2010, New Orleans, June 8th, 2010…
Start, Open Programs… Expand Windows AIK, highlight “Deployment Tools Command Prompt”. Explain why it is necessary to use “Run As Administrator” for this. Right click and Run As Administrator.
Create a new folder at the root of C:\ Some names we can use: win7pe, win7re, win7_64, etc.
mkdir c:\win7pe
cd c:\win7pe
Create two new folders; mount and mountre in the root of the folder above.
mkdir mount
mkdir mountre
Explain why we need the installation DVD. Explain how the recovery environment is available in the install.wim image, and what we are now going to do is extract it from the install.wim. Explain that the install.wim file is huge (perhaps even show it from the DVD drive, at DVD drive letter:\sources\install.wim); almost 3 GBs, so the copy will take 6-8 minutes.
copy d:\sources\install.wim c:\win7pe
When the file completes its copying, then we can mount it and extract the recovery environment wim.
We’ll use DISM to do so, rather than imagex.exe If you check Microsoft TechNet article on making a recovery environment iso, it uses imagex.exe. I will use the dism tool because it is designed to be the replacement for this feature (mounting, etc) from imagex. DISM is superior to imagex and is several tools rolled into one.
dism /mount-wim /wimfile:c:\win7pe\install.wim /index:1 /mountdir:c:\win7pe\mount
This will mount the install.wim into the mount directory. We can see the file format in Windows Explorer (do so). Point out the winRE.wim located in \windows\system32\recovery. This is the file we’re after and why we’ve used the installation DVD in the first place. In fact, after we copy out this file we’ll discard the install.wim.
copy c:\win7pe\mount\windows\system32\recovery\winre.wim c:\win7pe
Now that we done so successfully, we can unmount the install.wim and discard any changes we’ve made to it. We’ll do so using DISM again:
dism /unmount-wim /mountdir:c:\win7pe\mount /discard
And then we’ll mount the winre.wim using DISM:
dism /mount-wim /wimfile:c:\win7pe\winre.wim /index:1 /mountdir:c:\win7pe\mountre
Now use Windows Explorer to look at the various directories. Note that windows\system32 does not have the imagex.exe program. We need it for latter. To that end, we’re going to copy imagex.exe into the mounted winre.wim. We need to ensure we select the imagex.exe program from the correct architecture: 32-bit, 64-bit, or Itanium. So open up windows explorer and look in c:\program files\windows aik\tools. You’ll not the x86 folder (32bit); amd64 (64-bit) and ia86 (Itanium). Each folder has an imagex.exe in it. Since we used the installation DVD for Windows 7 Ultimate, 64-bit edition, we need to copy over the imagex.exe file from the amd64 directory, as follows (explain necessary use of quotes below and why):
copy “c:\program files\windows aik\tools\amd64\imagex.exe” c:\win7pe\mountre\windows\system32
Since that is all we need for this WinPE/RE UFD (USB Flash Disk), we can now unmount the winre.wim file. Since we want to make the inclusion of imagex.exe a permanent thing, we’ll commit the changes, using DISM:
dism /unmount-wim /mountdir:c:\win7pe\mountre /commit
This will save all changes back to the c:\win7pe\winre.wim file. We can now proceed to the final step.
Since it was the recovery environment we wanted to have on the UFD, in addition to WinPE, we’ll follow the steps outlined in TechNet to create a WinPE UFD. The first step is to extract the everyday WinPE 3.0 that comes with the Windows AIK:
copype amd64 c:\peufd
This will create a multi-directory structure with WinPE in it
.
We will now copy over our WinRE.wim we extracted and updated earlier. We’re going to rename it boot.wim when we copy it, so it will fit nicely onto the typical iso for WinPE:
copy c:\win7pe\winre.wim c:\peufd\iso\sources\boot.wim
Our next step will be to clean and partition our UFD and place the ISO on it, and that is in the second demo.
Insert a USB Flash Disk (UFD) into a USB port. I’m going to use a 2GB UFD. The next few steps will wipe out any data on it, so do not use one that has data you need to keep. We’ll be using the DISKPART command line tool to wipe and format the UFD.
In the Deployment Tools Command Prompt, enter:
diskpart
If more than one HDD is on the host machine, select the proper number! Since HDD are numbered cardinally (starts with 0) the UFD will be the last drive number. I have only one hard drive, so the UFD will be disk 1. If you have two HDD, use disk 2 for your UFD.
At the diskpart prompt type:
list disk
(SHOW DISKS MAKE SURE YOU USE THE CORRECT ONE!)
select disk 1
clean
(This really wipes out the disk! Careful!)
create par prim
sel par 1
active
format quick fs=ntfs
assign letter=f
exit
Diskpart closes.
Now we simply xcopy over the iso files from the iso root to our ufd..
xcopy c:\peufd\iso\*.* /e f:\
And we now have a functioning UFD WinPE/RE! We can boot to it (on motherboards that allow USB booting—most modern motherboards do). So we’ll now take the UFD to a machine we can boot from USB and boot it.