Enable Windows 10 Recovery Environment

Problem:

  1. Nov 09, 2015  Unable to enable BitLocker after clean install of Windows 10 After Windows 10 Release. Ask your administrator to configure Windows Recovery Environment so that you can use BitLocker. I checked the forums on how to enable the Windows Recovery Environment. The ReAgent file found in the Recovery Media's.wim file does not have values for the.
  2. In Windows 10, the Windows Recovery Environment has become a very sophisticated, almost eerily intelligent fix-everything program that works very well. Except, of course, when it doesn’t. You know you’re in the Windows Recovery Environment if you see a blue Choose an Option screen or a blue Troubleshoot screen like the one shown here.

The Windows Recovery Environment (WinRE) for Windows 7, Windows 8, or Windows 10 does not function correctly. The system is unable to boot into WinRE.

Jul 16, 2019  How to Enable or Disable Windows Recovery Environment (WinRE) in Windows 10 Windows Recovery Environment (WinRE) is a recovery environment that can repair common causes of unbootable operating systems. By default, WinRE is preloaded into the Windows 10 for desktop editions (Home, Pro, Enterprise, and Education) and Windows Server 2016 installations.

Additionally, the TBWinRE script is unable to modify WinRE on the system and may be unable to create the TBWinRE boot media.

Cause:

There are a number of reasons WinRE is unable to function, including:

Enable Windows 10 Recovery Environment Software

  • WinRE is disabled.
  • The BCD file is not configured correctly to boot WinRE.
  • The winre.wim file is missing or not at the expected location.
  • The WinRE configuration file is missing or contains invalid information.

Solution:

Use the following methods to attempt a repair of WinRE. You may wish to read through all the methods before beginning as some may not be applicable to your situation or you may need to try them in a different order.

Note: Repairing WinRE will require using an Administrator Command Prompt. Reference the instructions below as necessary.
If using Windows 7: Click on the Start button, then All Programs, then Accessories (alternatively, press the Windows Key and type Command Prompt). Right-click on the Command Prompt item and select Run as administrator from the pop-up menu. If a UAC prompt is displayed, click the Yes button.
If using Windows 8.x/10: Press the Windows Key to display the Start screen and then type Command Prompt. The program should show in the search results. Right-click on the Command Prompt item and click Run as administrator. If a UAC prompt is displayed, click the Yes button.

Alternatively, in Windows 8.x/10 you can press WinKey+X to display the Quick Link menu. Select Command Prompt (Admin) and click Yes on the UAC prompt (if displayed). Note that if the Taskbar settings are configured to display the Windows PowerShell items in the Quick Link menu, you would need to select Windows PowerShell (Admin) and then run 'cmd' at the prompt to switch to the Command Prompt.

Unable to Build TBWinRE Boot Media

If WinRE is broken, but you have the correct Winre.wim file for the system and you only want to build the TBWinRE boot media, it's not necessary to repair WinRE. Instead, you can just copy the Winre.wim file into the WinRE_Backup folder of the TBWinRE folder (e.g. D:TBWinREWinRE_Backup). Be sure to use a version of the Winre.wim file that's compatible with your version of Windows.

Disable & Enable WinRE

Sometimes all that's needed is to disable WinRE prior to enabling. Run the following commands from an Administrator Command Prompt:
reagentc /disable
reagentc /enable

Note: It's possible for the disable to report an error and still have enable succeed.

Remove ReAgent.xml and Place Winre.wim at Default Location (Windows 8.x/10)

If using Windows 8.x/10 you can try this simple method to repair WinRE. In most cases, this method will work. However, you may want to save a backup copy of ReAgent.xml before deleting it in case you need to try some of the other repair methods.

  1. Open an Administrator Command Prompt.
  2. Change to the C:WindowsSystem32Recovery folder:
    cd /d C:WindowsSystem32Recovery
  3. Delete or rename the ReAgent.xml file:
    del ReAgent.xml
    or
    ren ReAgent.xml ReAgent_backup.xml
  4. Copy the Winre.wim file into the C:WindowsSystem32Recovery folder. Be aware that the winre.wim file often has the hidden and system attributes set. You can remove these using the attrib command and then perform a normal copy or copy the file with the xcopy command and keep the attributes intact. For example, assuming the Winre.wim file you want to copy is located in C:RecoveryWindowsRE:
    Remove attributes and copy file:
    attrib -h -s c:RecoveryWindowsREwinre.wim
    copy c:RecoveryWindowsREwinre.wim c:WindowsSystem32Recovery

    Copy file and retain hidden and system attributes:
    xcopy /h c:RecoveryWindowsREwinre.wim c:WindowsSystem32Recovery
    Note: It is recommended to copy the file using the Command Prompt instead of using Windows File Explorer, especially if the file has the hidden and system attributes set.
  5. Try enabling WinRE by running the following command:
    reagentc /enable

Place Winre.wim at the Correct Location

Make sure the Winre.wim file exists in the expected path (e.g. on the existing Recovery partition) or in the C:WindowsSystem32Recovery folder. Note that both the folder and the file may be hidden (enable viewing of hidden/system files, if necessary).
You can determine if the original path is still being used by viewing the ReAgent.xml file and checking the path for the ImageLocation. The ReAgent.xml file is located in the C:WindowsSystem32Recovery folder and can be opened using Internet Explorer, Notepad, or WordPad. If using Notepad you will most likely want to enable word wrapping for easier viewing. Look for <ImageLocation path= and note the path value specified (e.g. <ImageLocation path='RecoveryWindowsRE'). If the original Recovery partition is no longer available you can create the path on the Windows partition and copy the Winre.wim file into it. In this example, you would copy Winre.wim into the C:RecoveryWindowsRE folder. Note: It is recommended to copy the file using the Command Prompt instead of using Windows File Explorer, especially if the file has the hidden and system attributes set.
Then try enabling WinRE by running the following commands from an Administrator Command Prompt:
reagentc /disable
reagentc /enable

Reset the ReAgent.xml File

If none of the above methods worked you can try resetting sections of the ReAgent.xml file (make a backup copy of the file first, if you wish).

This example will use WordPad to edit the file (using Notepad is not recommended since line breaks won't be displayed). Be aware that long lines will wrap -- do not add any new line breaks. Start an Administrator Command prompt and run the following command:
write c:windowssystem32reagent.xml
Edit these sections to clear/reset the values: WinreBCD, WinreLocation, ImageLocation, InstallState, WinREStaged. Leave other sections and settings unchanged. The example below is from an OEM Windows 8 installation (your file contents may be different). The indicated sections are shown with cleared/reset values.
<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version='1.0'>

<WinreBCD/>
<WinreLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}'/>
<ImageLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}'/>

<OsInstallLocation path='OKRbackupfactory' offset='728680628224' guid='{f0ea3b1a-8657-4f56-abd1-dfea687a2d2f}' index='1'/>
<CustomImageLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}' index='0'/>

<InstallState state='0'/>
<OsInstallAvailable state='1'/>
<CustomImageAvailable state='0'/>
<IsAutoRepairOn state='0'/>

<WinREStaged state='0'/>
<OperationParam path='/>
<OsBuildVersion path='9200.16384.amd64fre.win8_rtm.120725-1247'/>
<OemTool state='1'/>
<BootKey state='0'/>
<IsServer state='0'/>
<ScheduledOperation state='4'/>
</WindowsRE>

Here is another example of the file in its cleared state. This one is from Windows 10 (1709).

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version='2.0'>
<WinreBCD/>
<WinreLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}'/>
<ImageLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}'/>
<PBRImageLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}' index='0'/>
<PBRCustomImageLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}' index='0'/>
<InstallState state='0'/>
<OsInstallAvailable state='0'/>
<CustomImageAvailable state='0'/>
<IsAutoRepairOn state='0'/>
<WinREStaged state='0'/>
<OperationParam path='/>
<OperationPermanent state='0'/>
<OsBuildVersion path='/>
<OemTool state='0'/>
<IsServer state='0'/>
<DownlevelWinreLocation path=' offset='0' guid='{00000000-0000-0000-0000-000000000000}'/>
<IsWimBoot state='0'/>
<NarratorScheduled state='0'/>
<ScheduledOperation state='0'/>
</WindowsRE>

Save the file and close WordPad.

Make sure the Winre.wim file is in the C:WindowsSystem32Recovery folder. Then try enabling WinRE by running the following command:
reagentc /enable

Correct Invalid BCD File WinRE Reference

Verify the BCD entries for WinRE are correct.

Could Not Find The Recovery Environment Fix

Note: Successfully enabling WinRE using reagentc should automatically fix the BCD entries. However, this method is helpful when it's known that just the recoverysequence item's value is incorrect. Performing an automated boot repair using the Windows Startup Repair program can sometimes cause this type of problem. If other WinRE related BCD entries are missing or incorrect (e.g. items and/or sub-items in the linked WinRE section), these instructions won't repair it.

  1. Open an Administrator Command Prompt.
  2. Run the following command to display the BCD entries:
    bcdedit /enum all
  3. Scroll through the entries and find the one for the currently booted Windows system. It will be a Windows Boot Loader entry with the identifier set to {current}. For example:
    Windows Boot Loader
    -------------------
    identifier {current}
    device partition=C:
    path Windowssystem32winload.exe
    description Windows 7
    locale en-US
    inherit {bootloadersettings}
    recoverysequence {d1758ad0-da09-11de-87b2-fe21320b6b8c}
    recoveryenabled Yes
    osdevice partition=C:
    systemroot Windows
    resumeobject {d1758ace-da09-11de-87b2-fe21320b6b8c}
    nx OptIn

  4. Note the GUID value for the recoverysequence item. In this example, the GUID is {d1758ad0-da09-11de-87b2-fe21320b6b8c}.
  5. Next, look through the entries for a Windows Boot Loader entry with an identifier that's set to the GUID value. The description should be Windows Recovery Environment. An example is shown below. Note that several lines will wrap in the output (e.g. device and osdevice) and several additional lines are wrapped by this article's formatting.
    Windows Boot Loader
    -------------------
    identifier {d1758ad0-da09-11de-87b2-fe21320b6b8c}
    device ramdisk=[C:]Recoveryd1758ad0-da09-
    11de-87b2-fe21320b6b
    8cWinre.wim,{d1758ad1-da09-11de-87b2-fe21320b6b8c}
    path windowssystem32winload.exe

    description Windows Recovery Environment
    inherit {bootloadersettings}
    osdevice ramdisk=[C:]Recoveryd1758ad0-da09-
    11de-87b2-fe21320b6b
    8cWinre.wim,{d1758ad1-da09-11de-87b2-fe21320b6b8c}
    systemroot windows
    nx OptIn
    winpe Yes

    If not found, look for another Windows Recovery Environment entry (will have a different GUID) with Winre.wim at the correct location (the device and osdevice items show the path for the Winre.wim file). The location can be a drive letter (as in the above example) or a volume reference (e.g. [DeviceHarddiskVolume3]). If the correct entry is found it can be linked to the Windows entry by running the following command (make sure to use the GUID of the found entry). Command should all be on one line.
    bcdedit /set {current} recoverysequence {d1758ad1-da09-
    11de-87b2-fe21320b6b8c}

Note: If you have a multi-boot configuration using the Microsoft Boot Manager be aware that each Windows 7/8.x/10 boot entry will have its own Windows Recovery Environment entry.

Find & Restore the Winre.wim File

If the Winre.wim file is missing on your system you can try one of the following methods to locate it:

Enable
  • If you have created a TBWinRE build on the system you can find a backup copy of the Winre.wim file in the WinRE_Backup folder of the build's folder (e.g. D:TBWinREWinRE_Backup).
  • Search the system for the file. From an Administrator Command Prompt, run the following command to search a drive for the Winre.wim file:
    dir /a /s c:winre.wim
    The above will search the C: drive for the file, including sub-folders and hidden folders. Depending on the system there may be multiple copies of the file found or there may be none.
    Many systems are configured with WinRE on a separate partition that is not normally assigned a drive letter. In order to search these partitions you would need to use Disk Management to assign a drive letter (may not be possible, in all cases).
    Note: If you previously had or currently have a version of Rollback Rx installed, the Winre.wim file may have been renamed to Winre.dat. If that's the case, run the search for it instead and rename it when you copy it for WinRE (or TBWinRE) to use. For example:
    dir /a /s c:winre.dat
    Be aware that the winre.wim file often has the hidden and system attributes set. You can remove these using the attrib command and then perform a normal copy or copy the file with the xcopy command and keep the attributes intact. For example, assuming the Winre.wim file you want to copy is located in C:RecoveryWindowsRE:
    Remove attributes and copy file:
    attrib -h -s c:RecoveryWindowsREwinre.wim
    copy c:RecoveryWindowsREwinre.wim c:WindowsSystem32Recovery

    Copy file and retain hidden and system attributes:
    xcopy /h c:RecoveryWindowsREwinre.wim c:WindowsSystem32Recovery
    Note: It is recommended to copy the file using the Command Prompt instead of using Windows File Explorer, especially if the file has the hidden and system attributes set.
  • If the system previously had a functioning WinRE and you have a backup image from that time you may be able to recover the file from your backup. For example, if you have a backup of the Windows 8 Recovery partition before it was deleted, use TBIView or TBIMount to access the backup and copy the Winre.wim file out. Keep in mind that it may be located in a hidden folder and the file itself may be hidden (these files/folders will show up normally in TBIView).
  • Locate the Winre.wim file on another system using the same version and architecture of Windows and copy it to the broken system. For example, if your desktop system running Windows 7 x64 is missing the file you could copy it from your laptop running Windows 7 x64.
  • If you have a standard Windows installation DVD or USB flash drive that contains the Install.wim file (not Install.esd) you can mount it and copy out the Winre.wim file. The Install.wim file will normally be located in the sources folder on the boot media.
    • Create a new folder to use as the mount point. The folder must exist on an NTFS partition and it must be empty. In this example, E:Win7-Install will be used.
    • Open an Administrator Command Prompt.
    • Determine the correct index to use by running the following command (specify the correct drive letter and path to Install.wim for your system):
      dism /get-wiminfo /wimfile:'D:sourcesinstall.wim'
      Examine the output to find the index of the Windows installation. In the case of multiple versions (Home, Pro, etc.) you can just select one of them. Index 2 is used in this example.
    • Mount the Install.wim file to the mount point. Command should all be on one line.
      dism /Mount-Wim /WimFile:'D:sourcesinstall.wim'
      /index:2 /MountDir:'E:Win7-Install' /readonly

      The mount may take several minutes to complete.
    • Browse to the E:Win7-InstallWindowsSystem32Recovery folder and copy out the Winre.wim file.
    • Unmount the Install.wim file. Command should all be on one line.
      dism /unmount-wim
      /mountdir:'E:Win7-Install' /discard

  • Windows 10 only: If you have installation boot media or downloaded upgrade files that contain the Install.esd file you can extract the contents and copy out the Winre.wim file. This file will normally be located in the sources folder (may be a sub-folder such as x64sources) on the boot media. Note that it's recommended to have at least 15GB of free space available on the drive where you extract the file (extracted files can be deleted once you've obtained the Winre.wim file). If necessary, the Windows 10 Media Creation Tool can be downloaded from Microsoft.
    • Create a new folder to contain the extracted files. The folder should be on an NTFS partition and it must be empty. In this example, E:Win10-Extract will be used.
    • Open an Administrator Command Prompt.
      Note: When running the Dism commands, if Dism has errors or problems working with the Install.esd file you may need to rename it to Install.wim. If the file is on read-only media this will require copying it to a new location first.
    • Determine the correct index to use by running the following command (specify the correct drive letter and path to Install.esd for your system):
      dism /get-wiminfo /wimfile:'D:sourcesinstall.esd'
      Examine the output to find the index of the Windows installation. In the case of multiple versions (Home, Pro, etc.) you can just select one of them. Index 1 is used in this example.
    • Extract the Install.esd file contents to the folder you created. Command should all be on one line.
      dism /apply-image /imagefile:'D:sourcesinstall.esd'
      /index:1 /applydir:'E:Win10-Extract'

      This process will take a little while to complete.
    • Browse to the E:Win10-ExtractWindowsSystem32Recovery folder and copy out the Winre.wim file.
    • You can now delete the E:Win10-Extract folder to free up the space. This can be done from the prompt or in Explorer. To delete it from the Command Prompt run:
      rd /s 'E:Win10-Extract'
      Important: Make sure you specify the correct folder path to delete.

Could Not Find The Recovery Environment 10

Note: Regardless of the method used to find Winre.wim, you should make sure to use a version of the file compatible with the version and architecture of Windows for which WinRE is being repaired. For example, if you are repairing WinRE on a Windows 8 64-bit system you should use the Windows 8 64-bit Winre.wim file.