低空飛行の航空日誌

何かあったことをつらつらと気の向くままに

How to create Windows PE 5.0 media

This article will guide you through the steps to creating your own bootable Windows PE 5.0 media.
You will be able to use this media to capture a custom WIM file which used for deployment or recovery.
Also, you can use this media for recovering system from your custom WIM file.

Boot time are :

CD or DVD 5 to 7 minutes
USB Flash Media 1 to 2 minutes

64-bit version can boot BIOS and UEFI systems. 32-bit version CAN NOT boot UEFI systems.

IMPORTANT NOTES

.net Framework GUI application limitations

Windows PE can include ".net Framework" component, although CAN NOT RUN .NET GUI APPLICATIONS due to limitations.
If you want to use GUI applications in Windows PE, you MUST build applications in C/C++ language.

WOW, WOW64 subsystem limitations

x86 version : It has NO WOW(Windows on Windows) subsystem, so you can NOT RUN ANY 16-BIT APPLICATIONS.
x64 version : It has NO WOW and WOW64(Windows on Windows 64-bit) subsystem, so you CAN NOT RUN ANY 16-BIT AND 32-BIT APPLICATIONS.

1. Install Windows ADK

Download and install Windows ADK to your computer.
http://www.microsoft.com/en-US/download/details.aspx?id=39982

2. Copy necessary files of Windows PE

click "Start", "All Programs", "Windows Kits", "Windows ADK", and right click "Deployment and Imaging Tools Environment" and click "Run as administrator".

At the prompt, type like this. Command-line syntax is shown below this subsection.

Copype.cmd x86 C:\winpe_x86

Hit return key, you will see following directories are created in specified destination.

C:\winpe_x86
C:\winpe_x86\fwfiles
C:\winpe_x86\media
C:\winpe_x86\mount
Command-line syntax
Copype.cmd <architecture> <destination>
Architecture options

You can choose one architecture from following:

x86 : 32-bit architecture. This is highly recommended. It is able to run many applications which has GUI(graphical user interfaces).

amd64 : 64-bit(aka x64) architecture. Due to WOW64 subsystem limitations (described at above), ANY 32-BIT APPLICATIONS CAN NOT RUN in Windows PE of this architecture.

arm : Not tested because I have no Windows RT devices. This will be useful for ARM-based Windows devices.

3. Mount master boot image

Type this command, you can mount master Windows PE image and be able to edit it.

Dism /mount-image:C:\winpe_x86\media\sources\boot.wim /index:1 /mountdir:C:\winpe_x86\mount

4. Adding components to Windows PE

You can add components to Windows PE image like these examples which described below.
IF DEPENDENCIES ARE SHOWN, YOU MUST ADD IT FIRST!!

All of the components which can be added to Windows PE image are listed here : WinPE: Add packages (Optional Components Reference)

ALL COMMANDS MUST BE IN ONE LINE.

1. WMI:Windows Management Instrumentation(WinPE-WMI)
Dism /image:C:\winpe_x86\mount /Add-package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WMI.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
2. Network support module that includes 802.1X support(WinPE-RNDIS, WinPE-Dot3Svc)
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-RNDIS.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-RNDIS_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-Dot3Svc.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-Dot3Svc_en-us.cab"
3. Encrypted drives (BitLocker) support module(WinPE-EnhancedStorage)
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-EnhancedStorage.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-EnhancedStorage_en-us.cab"
4. Windows Deployment Services client module(WinPE-WDS-Tools)
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WDS-Tools.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WDS-Tools_en-us.cab"
5. BitLocker and TPM support modules(WinPE-SecureStartup)

Dependencies : WinPE-WMI

Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-SecureStartup.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-SecureStartup_en-us.cab"
6. Limited version of .net Framework 4.5 (WinPE-NetFX)

Dependencies : WinPE-WMI

Dism /Image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-NetFx.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab"
7. WSHWindows Scripting Host(WinPE-Scripting)

Dependencies and install order : WinPE-WMI > WinPE-NetFX

Dism /Image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-Scripting.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"
8. Limited version of Windows PowerShell(WinPE-PowerShell)

Dependencies and install order : WinPE-WMI > WinPE-NetFX > WinPE-Scripting

Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-PowerShell.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab"
9. DISM command utilities(WinPE-DismCmdlets)

Dependencies and install order : WinPE-WMI > WinPE-NetFX > WinPE-Scripting > WinPE-PowerShell

Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-DismCmdlets.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab"
10. PowerShell commandlets for storage management: for iSCSI support(WinPE-StorageWMI)

Dependencies and install order : WinPE-WMI > WinPE-NetFX > WinPE-Scripting > WinPE-PowerShell

Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-StorageWMI.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab"
11. Language pack (English)
Dism /image:C:\winpe_x86\mount /Add-package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\lp.cab

4. Set Windows PE's locale to en-US

Another locales and keyboard layouts?
Please see here : Languages and International Servicing Command-Line Options

1. Set system locale to English (en-US)

INFO : Other "Set-InputLocale" option values are listed here : Default Input Locales

Dism /Image:C:\winpe_x86\mount /Set-AllIntl:en-US
Dism /image:C:\winpe_x86\mount /Set-InputLocale:0409:00000409
2. Set timezone

All available timezones are listed here : Microsoft Time Zone Index Values

Dism /image:C:\winpe_x86\mount /Set-TimeZone:"GMT Standard Time"

5. Commit changes to image

Commiting changes

Just you type this :

Dism /Unmount-Image /mountdir:C:\winpe_x86\mount /commit
Discarding changes

You can also discard changes to Windows PE image.
To discard changes, just you type this :

Dism /Unmount-Image /mountdir:C:\winpe_x86\mount /discard

6. Create bootable media

You can create ISO file or bootable USB flash disk.

You want to create both ISO file or bootable USB flash disk? Yes, you can create both of them.
WARNING : If you desired to create bootable USB flash disk, it is automatically formatted!!

Create ISO file
makewinpemedia /iso C:\winpe_x86 C:\winpe_x86\winpe50_x86.iso
Create bootable USB flash disk

If your USB flash disk is identified to drive "F:\", just you type this :

makewinpemedia /ufd C:\winpe_x86 F: