- Move Windows recovery partition using GParted - Wed, Dec 1 2021
- Configure Secured Core in Windows Server 2022: HVCI, DMA protection, System Guard, and VBS - Mon, Nov 22 2021
- ADMX templates for Office 2021: compatible with 2016 GPOs and 10 new settings - Mon, Nov 15 2021
Windows PE has always been part of the WAIK, or Windows ADK, but has been a separate download since Windows 10 1809. This gives the impression that one could create an ISO file or a USB stick with the separately downloaded WinPE files alone. But this is actually not the case.
Installing the WinPE package ^
If you run setup for Windows PE, it installs the files by default under the following path:
Alternatively, you can download the package into a different directory and start the setup from there. This option is particularly useful if you want to run the installation on other computers as well.
If you start the batch files that are used to create a bootable WinPE at this point, they will abort with various error messages. The main reason is the lack of required environment variables.
Adding deployment tools ^
Therefore, in the next step, you start the ADK Setup and select Deployment Tools for installation.
When this process is complete, open a command prompt and run the batch file DandISetEnv.bat in the Deployment Tools directory (by default under %ProgramFiles(x86)%\Windows Kits\10\Assessment and Deployment Kit).
Now provision the files that are needed for the ISO or the memory stick. This is done by running copype.cmd:
copype amd64 c:\Users\me\WinPE
The first parameter specifies the processor architecture, in this case 64-bit for Intel or AMD. You can also choose x86, arm, and arm64. The second parameter specifies the target directory. However, this must not yet exist; otherwise, the process will fail.
Adding packages to WIM ^
The boot.wim file can then be found in media\sources below the directory you specified above. If you want to customize Windows PE, for example by integrating language packs (WinPE is in English by default) or additional features, you mount the WIM with DISM. This is done on the command prompt from the directory you specified as the target in copype.cmd, where mount already exists:
dism /Mount-Wim /MountDir:mount /wimfile:media\sources\boot.wim /index:1
The language files can be found by default under the following path:
%ProgramFiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\<Architecture>\WinPE_OCs\.
These are added as follows:
dism /image:mount /Add-Package /PackagePath:<Path-to-languageFile>\lp.cab
For example, use
dism /image:mount /Set-AllIntl:de-DE
to set the language of the command line, the keyboard layout, and the location to Germany.
If you want to add PowerShell, the same pattern should be applied. However, you have to copy several packages in a given order. Like the language files, they are located under the directory WinPE_OCs:
To apply the changes to boot.wim, execute the following command:
dism /Unmount-Wim /MountDir:mount /commit
Activating a different keyboard layout online ^
If customizing boot.wim seems to be too much work because you just want to have a different keyboard layout, you can get one like this after booting WinPE:
wpeutil setkeyboardlayout 0407:00000407
This example activates the German keyboard layout. The individual country codes are listed on this page. Finally, you have to call a fresh copy of cmd.exe, because the change has no effect on the current command line.
Creating ISO ^
The last step is to create the boot media for Windows PE. The following command serves this purpose:
MakeWinPEMedia.cmd /ISO c:\Users\me\WinPE c:\users\me\WinPE.iso
The /ISO switch is obviously used to create a CD/DVD image, followed by the directory that you specified as the target in copype.cmd, and finally the name of the ISO file.
A USB stick is created in the same way, except that instead of the DVD, the UFD switch is required and the destination is simply the letter of the USB drive:
Subscribe to 4sysops newsletter!
MakeWinPEMedia /UFD c:\Users\me\WinPE G:
If you want to suppress the warning before the stick is formatted, you can add the /F switch to the command.