Windows preinstallation environment (windows PE) is a bootable tool that provides a minimal set of operating system features for installation, troubleshooting, and recovery. In this post I am going to explain how you can setup a windows PE environment to boot from a USB drive in 5 simple steps:
- Download and install windows AIK from Microsoft
- Prepare WinPE image
- Add drivers to your WinPE image
- Setup USB drive to be able to boot
- Copy the files to USB drive
Download and install windows AIK from Microsoft
Windows AIK is a set of tools and documentation that support the configuration and deployment of Windows® operating systems. You can download WAIK from Microsoft download center http://www.microsoft.com/download (search term WAIK) and install it to your computer for free.
After WAIK installation a set of folders will be created by default under program filesWindows AIK that contain the appropriate files and tools to create and manage WinPE images, unattended installation files, a volume activation management tool, SDKs and some sample files.
Prepare the WinPE USB image
After installing WAIK you are ready to prepare your WinPE image. In order to do so you have to go to program filesWindows AIKToolsPETools (default location) and copy your candidate WinPE image files to a temporary location. To do that you issue the command:
As a final step you need to copy and rename the base image file c:tempWinPEx86winpe.wim (based on the above example) to the ISOSources subdirectory of this temporary folder as boot.wim. To do this, issue the command
Add drivers to your WinPE USB image (optional)
In case you need to preload any drivers to your WinPE image or add optional components you have to follow some additional steps outlined below. In case you don’t you skip to the next section.
First step is to create a directory, for example c:tempWinPEx86Drivers, and download your drivers in this location. Note that the drivers must be fully extracted with their .inf files exposed in order to be added to the WinPE image.
Second step is to mount the base WinPE image copied previously. To do that execute
Third step is to add the downloaded drivers to the Image by executing
By including the /recurse switch you tell to the command to recurse the drivers’ subfolders for valid .inf drivers and by including the /ForceUnsigned you tell the command to ignore driver signing requirements.
Fourth step is to unmount and commit the WinPE image by executing
Note, that you can add additional files and folders to your custom WinPE image simply by copying your files to the c:tempWinPEx86Mount. These files will be loaded to the RAM drive after WinPE boot (c:). If you don’t want these files to be loaded to the RAM Drive (consumes RAM) and be available to the USB drive instead, just copy them to a structure under c:tempWinPEx86ISO folder.
Setup the WinPE USB drive to be able to boot
In this step you need to use the diskpart utility (windows Vista and above O/S) to create a bootable partition to your usb drive as outlined below.
Use Diskpart to identify the disk ID of your usb drive:
diskpart list disk
After you have identified your usb disk ID (based on size), you can wipe your partition information, create a new one and mark it as active.
select disk 1 clean create partition primary select partition 1 active format quick fs=ntfs assign exit
Copy the files to USB drive
Final step is to copy the files included under your ISO subfolder to your USB drive:
Note that you may need to alter your PC’s BIOS settings in order to be able to boot from USB drives and of course it needs to be USB boot capable.
To manipulate winPE environment you need to use the wpeutil <command> <argument> command. Most usable commands of wpeutil: EnableFirewall, DisableFirewall, Reboot, ShutDown, Initializenetwork.