Customize Windows RE

You can customize Windows Recovery Environment (Windows RE) by adding languages, driver packagess, OS packages, and custom diagnostic or troubleshooting tools.

The WinRE image is included inside the installation images of Windows 10 and later, and Windows Server 2016 and later, and is eventually copied to the Windows RE tools partition on the destination PC or device. To modify the WinRE image, you'll mount the Windows image, then mount the WinRE image inside it. Make your changes, unmount the WinRE image, then unmount the Windows image.

Note

If your Windows image doesn't contain a WinRE image (usually because WinRE has been moved to the RE tools partition prior to capturing the image), Windows will still work but the recovery environment won't be configured or accessible. You can add WinRE.wim back into your Windows image by copying it from the Windows\System32\Recovery folder of a mounted Windows image back into the same folder of your custom image.

image: Mount the Windows image, then mount the recovery image inside it. Make changes, then unmount the recovery image, and finally the Windows image

When you make changes to your Windows images, update the Windows RE image at the same time. If you're adding any of the following to your image, you should also update your recovery image with the same changes:

  • Add driver packages that are needed for a system to boot.
  • Adding quality or feature updates to Windows.
  • Add new languages, though this isn’t always possible, as not all languages have Windows RE equivalents.

This topic also gives optional steps to optimize the Windows RE image after updating it.

Prerequisites

To complete this walkthrough, you need the following:

  • A technician computer with the Windows Assessment and Deployment Kit (ADK) and WinPE addon installed.
  • The Windows image (install.wim). This can be from the Windows installation media or from a reference image.

Step 1: Mount the Windows and Windows RE image

Mount the images

  1. Open the Command prompt as an administrator.

  2. Mount the Windows base image for editing.

    md C:\mount\windows
    Dism /Mount-Image /ImageFile:C:\mount\install.wim /Index:1 /MountDir:C:\mount\windows
    
  3. Mount the Windows RE image for editing.

    md C:\mount\winre 
    Dism /Mount-Image /ImageFile:c:\mount\windows\windows\system32\recovery\winre.wim /Index:1 /MountDir:C:\mount\winre
    

    Note

    The Windows RE image should always be index number 1.

Step 2: Adding languages

When you add languages to Windows RE, you need to add the base language pack and the corresponding language packs for each of the Windows PE optional components in the Windows RE tools image.

The base language pack and optional component language packs required to customize Windows RE are included in the Languages and Optional Features ISO.

Starting with Windows 10, Version 1607 and Windows Server 2016, the base language pack and optional component language packs required to customize Windows RE are included in the Language Pack ISOs for Windows 10 and Windows Server 2016. The Windows PE language packs in the Windows 10 ADK should not be used to customize Windows RE.

Note

To ensure a consistent language experience in recovery scenarios, add the same set of languages to the Windows RE image that you add to the Windows image.

Try not to add more than ten language packs to a Windows or Windows RE image. Multiple language packs increase the size of the Windows image and also affect the overall performance of a system during deployment and servicing.

Add language packs

  1. Mount the Languages and Optional Features ISO by double-clicking it in File Explorer. This will assign it a drive letter, for example, D.
  1. Mount the Windows Language pack ISO by double-clicking it in File Explorer. This will assign it a drive letter, for example, D.
  1. List the Windows PE optional components in the Windows RE tools image:

    Dism /Get-Packages /Image:C:\mount\winre
    
  2. Review the resulting list of packages, and then add the corresponding language packs for each package in the image, including the base Windows PE language pack, but not including WinPE-WiFi-Package.

    The following code shows how to add the French (fr-fr) language pack to the base Windows PE image, and then to each of the optional components that are present in the default Windows RE image:

    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\lp.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-Rejuv_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-EnhancedStorage_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-Scripting_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-SecureStartup_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-SRT_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-WDS-Tools_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-WMI_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-StorageWMI_fr-fr.cab"
    Dism /Add-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\fr-fr\WinPE-HTA_fr-fr.cab"
    

    The WinPE-WiFi-Package is not language-specific and does not need to be added when adding other languages.

  3. If you're adding language packs for Japan, Korea, or China, add the font packages for these languages. Here's an example for Japan:

    Dism /image:C:\mount\winre /add-package /packagepath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Font Support-JA-JP.cab"
    

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

  4. To save space and speed up the recovery process, remove unneeded languages. Reverse the order to avoid problems with dependencies.

    Note, the WinPE-WiFi-Package is not language specific and should not be removed.

    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-HTA_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WDS-Tools_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-SRT_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-SecureStartup_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-EnhancedStorage_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Rejuv_en-us.cab"
    Dism /Remove-Package /Image:C:\mount\winre /PackagePath:"D:\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\lp.cab"
    

Step 3: Adding driver packages that are needed for a system to boot

Make sure that you add any third-party driver packages that your reference system requires to boot.

Add a driver package:

  1. If necessary, unzip or unpack the driver file from your device manufacturer.

  2. Identify the driver package, and add it to the image.

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

    where C:\SampleDriver\driver.inf is the location of the .inf file.

Step 4: Adding a custom tool

You can add a custom troubleshooting or diagnostic tool to your Windows RE image. To learn more, see Add a Custom Tool to the Windows RE Advanced startup Menu.

Step 5: Adding Windows updates

If you've added an update to your Windows image, update your WinRE image as well:

  • Add the Windows update package, for example, C:\MSU\Windows8.1-KB123456-x64.msu.

    Dism /Add-Package /PackagePath:C:\MSU\Windows8.1-KB123456-x64.msu /Image:C:\mount\winre /LogPath:AddPackage.log
    

Step 6: Optimizing the image, part 1 (optional)

After adding a language or Windows update package, you can reduce the size of the final Windows RE package by checking for duplicate files and marking the older versions as superseded.

  1. Optimize the image:

    Dism /Image:c:\mount\winre /Cleanup-Image /StartComponentCleanup
    
  2. Later, you'll export the image to remove the superseded files.

Step 7: Unmount the WinRE image

  • Unmount and save the image:

    Dism /Unmount-Image /MountDir:C:\mount\winre /Commit
    

Step 8: Optimizing the image, part 2 (optional)

If you've optimized the image, you'll need to export the image in order to see a change in the file size. During the export process, DISM removes files that were superseded.

  1. Export the Windows RE image into a new Windows image file.

    Dism /Export-Image /SourceImageFile:c:\mount\windows\windows\system32\recovery\winre.wim /SourceIndex:1 /DestinationImageFile:c:\mount\winre-optimized.wim
    
  2. Replace the old Windows RE image with the newly-optimized image.

    del c:\mount\windows\windows\system32\recovery\winre.wim
    copy c:\mount\winre-optimized.wim c:\mount\windows\windows\system32\recovery\winre.wim
    

Step 9: Unmount the Windows image

Save your changes back into the Windows base image.

  • Unmount the base Windows image:

    Dism /Unmount-Image /MountDir:C:\mount\windows /Commit
    

Next Steps

If you’re deploying Windows using Windows Setup, update the other Windows images inside the base Windows file (Install.wim).

If you’re deploying your reference image by using Windows PE, Diskpart, and DISM, then continue to Deploy Windows RE.

Add a Custom Tool to the Windows RE Advanced startup Menu

Deploy Windows RE

Deploy Push-Button Reset Features

REAgentC Command-Line Options