Installing Windows PE on HDD/SSD

Installing Windows PE (Preinstallation Environment) on your HDD/SSD can be an alternative to creating a bootable USB stick or DVD. Assuming that Windows is installed and running, you can easily install Windows PE for future use without any third-party tools or Microsoft's infamous Media Creation Tool. By installing Windows PE into a virtual disk, you do not need to modify existing partitions on your HDD/SSD.

The following commands need to be run in a console with Administrator privileges:

  1. Download a Windows 10/11 ISO image and extract the \sources\boot.wim file.
  2. Run %windir%\system32\diskpart.exe to create a virtual disk:
    create vdisk file="c:\pe.vhd" maximum=2000 type=expandable
    attach vdisk
    create partition primary
    format fs=ntfs quick
    assign letter=p
    exit
  3. Apply the boot.wim image (assuming its path is c:\boot.wim) to the virtual disk:
    %windir%\system32\Dism.exe /Apply-Image /ImageFile:"c:\boot.wim" /Index:1 /ApplyDir:P:\
    %windir%\system32\Dism.exe /Image:P:\ /Set-TargetPath:X:\
  4. Add Windows PE to the boot menu:
    %windir%\system32\bcdboot.exe P:\windows /d
  5. You may also want to change the input and user locales. For example, to set a German keyboard layout and German number, date and time formats:
    %windir%\system32\Dism.exe /Image:P:\ /Set-InputLocale:de-de
    %windir%\system32\Dism.exe /Image:P:\ /Set-UserLocale:de-de

When the system starts, you can now boot directly to Windows PE:

Windows Boot Manager

Removing Windows PE

Use these commands to remove Windows PE:

del c:\pe.vhd
%windir%\system32\bcdboot.exe /bcdclean full

This will delete the virtual disk and remove the Windows PE boot menu entry.