WinPE: Mount and Customize

Add drivers to Windows Preinstallation Environment (WinPE), such as graphics drivers or network drivers.

Common customizations:

Get the Windows Assessment and Deployment Kit with Windows PE tools

Create a set of either 32-bit or 64-bit Windows PE files

  1. Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.

  2. In the Deployment Tools and Imaging Environment, copy the WinPE files for the PCs you want to boot.

    • The 64-bit version can boot 64-bit UEFI and 64-bit BIOS PCs.

      copype amd64 C:\WinPE_amd64
    • The 32-bit version of WinPE can boot 32-bit UEFI, 32-bit BIOS, and 64-bit BIOS PCs.

      copype x86 C:\WinPE_x86

Mount the Windows PE boot image

  • Mount the WinPE image.

    Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE_amd64\mount"

Add customizations

Add device drivers (.inf files)

  • Add the device driver to the WinPE image.

    Dism /Add-Driver /Image:"C:\WinPE_amd64\mount" /Driver:"C:\SampleDriver\driver.inf"

    Although you can add multiple drivers to an image by using one command, it is often easier to troubleshoot problems by adding each driver package individually.

    To learn more about drivers, see Add device drivers (.inf files).

Add packages/languages/optional components/.cab files

  • Add the optional component into WinPE. To add optional components, you need to add both the optional component and its associated language packs.

    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\"  
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\"

    To learn more about adding packages, see WinPE: Add packages (Optional Components Reference).

Add files and folders

  • Copy files and folders into the C:\WinPE_amd64\mount folder. These files will show up in the X:\ folder in WinPE.

    Don't add too many files, as these will slow down WinPE and can fill up the available memory in the default RAMDisk environment.

Add a startup script

  • Modify the Startnet.cmd script to include your customized commands. This file is located at C:\WinPE_amd64\mount\Windows\System32\Startnet.cmd.

    You can also call other batch files or command line scripts from this file.

    For Plug and Play or networking support, make sure that you include a call to wpeinit in your customized Startnet.cmd script. For more info, see Wpeinit and Startnet.cmd: Using WinPE Startup Scripts.

Add an app

  1. Create an app directory inside the mounted WinPE image.

    md "C:\WinPE_amd64\mount\windows\<MyApp>"
  2. Copy the necessary app files to the local WinPE directory.

    Xcopy C:\<MyApp> "C:\WinPE_amd64\mount\windows\<MyApp>"
  3. Test the app later by booting WinPE and running the application from the X: directory.

    X:\Windows\System32> X:\Windows\<MyApp>

    If your app requires temporary storage, or if WinPE becomes unresponsive when it runs an app, you may need to increase the amount of temporary storage (scratch space) allocated to WinPE.

  4. To automatically launch a shell or application that runs when WinPE starts, add the path location to the Winpeshl.ini file. For more info, see Winpeshl.ini Reference: Launching an app when WinPE starts.

Add temporary storage (scratch space)

  • WinPE reserves memory on the X: drive to unpack the WinPE files, plus additional temporary file storage, known as scratch space, that can be used by your applications. By default, this is 512MB for PCs with more than 1GB of RAM, otherwise the default is 32MB. Valid values are 32, 64, 128, 256, or 512.

    Dism /Set-ScratchSpace:256 /Image:"C:\WinPE_amd64\mount"

Replace the background image

If you've got multiple versions of WinPE, you can set the background image so you can instantly tell which version of WinPE is running.

Change the security permissions of the WinPE background image file (\windows\system32\winpe.jpg). This allows you to modify or delete the file.

  1. In Windows Explorer, navigate to C:\WinPE_amd64\mount\windows\system32.

  2. Right-click the C:\WinPE_amd64\mount\windows\system32\winpe.jpg file, and select Properties > Security tab > Advanced.

  3. Next to Owner, select Change. Change the owner to Administrators.

  4. Apply the changes, and exit the Properties window to save changes.

  5. Right-click the C:\WinPE_amd64\mount\windows\system32\winpe.jpg file, and select Properties > Security tab > Advanced.

  6. Modify the permissions for Administrators to allow full access.

  7. Apply the changes, and exit the Properties window to save changes.

  8. Replace the winpe.jpg file with your own image file.

Set the power scheme to high performance

Note: Using the high performance power scheme can make the device run hotter than usual.

  1. In Notepad, edit the file: C:\WinPE_amd64\mount\windows\system32\startnet.cmd, adding a command to set the power scheme to High Performance.

    powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 

Add answer file settings

  • Some WinPE settings can be managed by using an answer file, such as firewall, network, and display settings. Create an answer file, name it unattend.xml, and add it to the root of the WinPE media to process these settings. For more information, see Wpeinit and Startnet.cmd: Using WinPE Startup Scripts.

Add updates to WinPE (if needed)

You can apply updates to your WinPE image, but you'll only need to for certain situations.

If you've been instructed to apply an update to your WinPE image, you'll have to first download the latest update for your WinPE version from the Microsoft update catalog. Updates for WinPE are included in updates for the matching version of Windows 10. You can find information about the latest available updates for Windows 10 at Windows 10 update history.

  1. Download the latest update.

  2. Apply the update to your mounted WinPE image.

    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"E:\windows10.0-kbxxxxx.msu"

    Where Windows10.0-kbxxxxx.msu is the name of the update file

  3. Lock in the update:

    dism /cleanup-image /image:C:\WinPE_amd64\mount\windows /startcomponentcleanup /resetbase /scratchdir:C:\temp

Unmount the Windows PE image and create media

  1. Unmount the WinPE image.

    Dism /Unmount-Image /MountDir:"C:\WinPE_amd64\mount" /commit
  2. Create bootable media, such as a USB flash drive.

    MakeWinPEMedia /UFD C:\WinPE_amd64 F:
  3. Boot the media. WinPE starts automatically. After the WinPE window appears, the wpeinit command runs automatically. This may take a few minutes. Verify your customizations.


To delete a working directory:

In some cases, you may not be able to recover the mounted image. DISM protects you from accidentally deleting the working directory, so you may have to try the following steps to get access to delete the mounted directory. Try each of the following steps:

  1. Try remounting the image:

    dism /Remount-Image /MountDir:C:\mount
  2. Try unmounting the image, discarding the changes:

    dism /Unmount-Image /MountDir:C:\mount /discard
  3. Try cleaning up the resources associated with the mounted image:

    dism /Cleanup-Mountpoints

Related topics

WinPE: Optimize and shrink the image

WinPE for Windows 10

WinPE: Create USB Bootable drive

WinPE: Create a Boot CD, DVD, ISO, or VHD

WinPE: Install on a Hard Drive (Flat Boot or Non-RAM)

WinPE: Boot in UEFI or legacy BIOS mode

WinPE: Add packages (Optional Components Reference)