- Install subsystem for Linux 2 (WSL2) on Windows Server - Wed, Jun 22 2022
- Next version of Exchange to arrive in 2025; meanwhile, new features for Exchange 2019 - Fri, Jun 10 2022
- Activate Remote Desktop in Windows 11 and Windows Server 2022 (GUI, WAC, WMI, and GPO) - Wed, Jun 8 2022
The Preinstallation Environment (WinPE) is a lean version of Windows that is used for OS deployment or for the Recovery Environment. Windows PE was always part of Windows ADK (formerly WAIK), but since Windows 10 1809, it has been a separate download. However, this alone is not enough to create an ISO file or a USB stick with WinPE. Instead, you still need the deployment tools from the ADK.
Install the WinPE package ^
If you run the setup for Windows PE, it installs the files as in Windows 10 at the following default location:
If you start the batch files, which are used to create a bootable WinPE, they abort at this point with various error messages due to the missing ADK.
Add deployment tools ^
Therefore, the next step is to start the ADK-Setup and select Deployment Tools for installation.
When this process is finished, 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). This sets the required environment variables.
Now, you provision the files you need for the ISO or the memory stick by using copype.cmd. A call could look like this:
copype amd64 %USERPROFILE%\WinPE
The first parameter specifies the architecture; in this case, 64-bit for Intel or AMD. You can choose between amd64, arm, and arm64. The second parameter specifies the target directory. However, this must not exist; otherwise, the process will terminate.
Create the ISO or bootable USB stick ^
At this point, you have already met the prerequisites for creating the Windows PE boot media. The following command will generate an ISO image:
MakeWinPEMedia.cmd /ISO %USERPROFILE%\WinPE .\WinPE.iso
The ISO switch is followed by the directory that you specified as the target for copype.cmd and the name of the ISO file.
The USB stick is created in the same way, except that you use the UFD switch and specify only the letter of the drive as the target:
MakeWinPEMedia /UFD c:\Users\me\WinPE G:
If you want to suppress the warning before formatting the disk, you can add the /F switch to the command.
After the successful completion of the process, you get a bootable but only bare-bones WinPE. It contains only the English language package, the English keyboard layout, and no tools. Therefore, you will usually want to customize the image for Windows PE before generating the disk.
Mount the WinPE image with DISM ^
The file boot.wim can be found in media\sources in the directory tree below the target folder of copype.cmd. If you want to customize Windows PE, you have to mount the WIM with DISM.
This is done at the command prompt from the directory that you specified as the target for copype.cmd, where the mount directory already exists:
dism /Mount-Wim /MountDir:mount /wimfile:boot.wim /index:1
Add a language package ^
By default, the language files can be found under %ProgramFiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\<Architecture>\WinPE_OCs\ in the directories named after the language codes.
For example, to add the German language pack in the x64 version, do the following:
dism /image:mount /Add-Package /PackagePath: "%ProgramFiles(amd64)%\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\lp.cab"
dism /image:mount /Set-AllIntl:de-DE
you set the UI language, keyboard layout, and location to Germany.
Integrate PowerShell and tools ^
If you want to add PowerShell, you have to copy several packages in a given order; they are located in the same directory as the language file:
Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\WinPE-WMI.cab" Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\de-de\WinPE-WMI_de-de.cab" Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\WinPE-NetFx.cab" Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\de-de\WinPE-NetFx_de-de.cab" Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\WinPE-PowerShell.cab" Dism /Image:mount /Add-Package /PackagePath:"%WinPERoot%\amd64\WinPE_OCs\de-de\WinPE-PowerShell_de-de.cab"
The three packages from the de-de directory are used for localization purposes. If you only need the English version of PowerShell, you don't have to install them.
If needed, you can copy your own tools into the image by changing to the desired folder under the mount directory, e.g., to the Program directory. Candidates might be the command line programs from SysInternals. However, you have to expect that many of them will not run on this stripped-down Windows.
To apply the changes to boot.wim, execute the following command:
dism /Unmount-Wim /MountDir:mount /commit
Creating a WinPE bootable disk has not changed much in Windows 11. You still need the command line tools from the Windows ADK and the separate WinPE download.
Subscribe to 4sysops newsletter!
A minimalistic Windows PE can be created quickly and with little effort. However, if you want additional language packs and a corresponding keyboard layout, you have to edit the image file. This is also the case if you want to add PowerShell or other tools.