Notes-on-WinPE-usage

In order to take full advantage of the script library in WinPE, use the following guide as a start to build your own PE image.

Step 1 - Start

We will assume you have installed Windows ADK and the WinPE addon, and you have opened Deployment and Imaging Tools Environment as an administrator. If you need help with this, check the Microsoft guidance

Next, start laying down your PE image:

copype amd64 C:\WinPE_amd64

Step 2 - Download driver cab cab

Download the HP PE driver CAB and unpack it to ... c:\temp\pepack in this example

You can find the PE driver pack at: http://ftp.hp.com/pub/caps-softpaq/cmit/HP_WinPE_DriverPack.html

Step 3 - Build the image

Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /Index:1 /MountDir:"C:\WinPE_amd64\mount"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFX_en-us.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-StorageWMI.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-SecureBootCmdlets.cab"
Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab"

Inject the Windows PE driver pack (use the path where you unpacked the drivers path, below):

Dism /Image:"C:\WinPE_amd64\mount"  /Add-Driver /Driver:c:\temp\pepack /Recurse
Dism /Unmount-Image /MountDir:C:\WinPE_amd64\mount /Commit

Step 4 - Write it to USB drive

Replace the drive letter F: with the drive letter of your USB drive, below:

MakeWinPEMedia /UFD C:\WinPE_amd64 F:

...where F: is your USB drive letter.

if you get a cryptic error such as '-2147024809' at this point, try preparing your USB drive ahead of time, and use a smaller partition. If your USB disk is less than 32-GB, you can leave out the size= below:

diskpart
list disk
select disk 1 (or the disk index of your USB disk)
clean
convert MBR
create partition primary size=<partition size>
format fs=fat32 quick label="WinPE"

Things to keep in mind

  • Some functionality (such as functionality that depends on identifying the current operating system) may not work in Windows PE.

  • SoftPaq-related functionality is not supported in WinPE.

  • When flashing the BIOS from WinPE, specify the '-BitLocker ignore' flag, since WinPE does not have the BitLocker-related checks, and our library will fail when trying to check if BitLocker is enabled

  • 32-bit WinPE is not supported.