Friday, April 8, 2016

How to create a bootable Windows PE flash drive

I learned about Windows PE just today, after I fought so hard with my Windows 7 installation thumb drive. Windows PE is so sweet. It stands for "Windows Preinstallation Environment". It is essentially a short cut to the command window tool that one can open with the regular Windows 7 installation drive, but also comes packed with extra utilities not available on the regular installation disk, such as imagex. Imagex is what we will be using at the very end to force the factory reset.

In order to create a Windows PE bootable flash drive, first you need to install WAIK on your healthy Windows 7 computer. WAIK stands for "Windows Automated Installation Kit" and it packs tools that IT personnel use to install Windows quickly on multiple computers. We only need it because it contains imagex and because it will allow us to create our Windows PE thumb drive.

Get it here, and make sure to get the one for Windows 7.

This is another iso file. You can burn it to a DVD and install off the DVD drive, or use a USB drive to install it.

If you got the USB thumbdrive route, you will need to use the Windows USB/DVD Download tool. There are other options, but this one is from Microsoft and is best for their product. I have personally tried Rufus and that failed, when the Windows USB/DVD Download tool worked.

The tool is pretty simple to use. Essentially. download it, install it, launch it and follow the instructions on the screens.

Once you have prepared your USB flash drive, you are not done. Remember that we wanted to install WAIK. Well now you have an installation disk for WAIK. WAIK is not an OS and does not require a reboot, nor is the USB bootable. If nothing launches, try to eject it and put it back into the drive. Or look for the setup.exe file or equivalent on the thumbdrive. Unfortunately, I did not document that part of the process, but I remember it being standard Windows.

Now launch WAIK. WAIK is always ran as an administrator and it is just a special version of the command prompt window. In your programs, look for "Deployment Tools Command Prompt" and right-click on it. Select "Run as administrator".

I have introduced the command prompt window in previous posts, the first one here. We are going to be using diskpart again, so that post is a good primer.

To create the bootable Windows PE disk, follow the instructions on this page. The are nice and clear (for once). I am reproducing them below only in case the page gets taken down.

Essentially, you want to copy and paste the following lines (commands) in the command prompt window, hitting [Enter] after each. Use the right button of your mouse to copy and paste. Each of these commands must be entered exactly as shown (aside from font). Every little symbol, every space or lack thereof. Welcome to computer hacking.

CopyPE.cmd amd64 C:\WinPE_amd64

DISM /Mount-WIM /WimFile:c:\WinPE_amd64\WinPE.wim /Index:1 MountDir:c:\WinPE_amd64\Mount

Copy “C:\Program Files\Windows AIK\Tools\amd64\ImageX.exe” C:\WinPE_amd64\Mount\Windows\System32\

DISM /Unmount-WIM /MountDir:C:\WinPE_amd64\Mount /Commit

The last command in the post produced an error message for me, because Windows randomly added quotation marks when I pasted the command. Watch for that:

Copy C:\WinPE_amd64\WinPE.wim C:\WinPE_amd64\ISO\Sources\boot.wim

Next you want to prepare your USB flash drive. It must be formatted a certain way. In particular, it needs to be formatted as FAT32. You may be able to use file explorer to do that, I have not tried. I used diskpart, as recommended in the original instructions.

You can use the same command prompt to run diskpart.
Launch the program and look at your disks by running the two commands
diskpart
list disk

Carefully identify which disk is your thumb drive. The best way to do that is by size.

Now select your thumb drive, partition and format it

select disk 2 (if the thumb drive is disk 2)
clean
create partition primary
list partitition (to double check)
select partition 1
active
format quick fs=fat32
assign

For me, I got some error messages after clean. If you do, try to proceed with the commands. It may do what you want it to do in the end. If all goes well, when you hit [Enter] after "assign", a window should pop up asking you what you want to do with your thumb drive. Click on "View folders".

Use file explorer the way you are accustomed to to copy files from the folder c:\winpe_amd64\iso to the usb drive. You will not be needing the rest. Your Windows PE flash drive is ready to go.


No comments:

Post a Comment