Problem:

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

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:

  • 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: 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.

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:\TBWinRE\WinRE_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.

Correct Invalid BCD File WinRE Reference

Verify the BCD entries for WinRE are correct.

Note: Successfully enabling WinRE using reagentc should automatically fix the BCD entries. However, this method is helpful when 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.

  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               \Windows\system32\winload.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:]\Recovery\d1758ad0-da09-
    11de-87b2-fe21320b6b
    8c\Winre.wim,{d1758ad1-da09-11de-87b2-fe21320b6b8c}
    path               \windows\system32\winload.exe

    description        Windows Recovery Environment
    inherit            {bootloadersettings}
    osdevice           ramdisk=[C:]\Recovery\d1758ad0-da09-
    11de-87b2-fe21320b6b
    8c\Winre.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. [\Device\HarddiskVolume3]). 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 and Window 8 boot entry will have its own Windows Recovery Environment entry.

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:\Windows\System32\Recovery 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:\Windows\System32\Recovery 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="\Recovery\WindowsRE"). 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:\Recovery\WindowsRE folder. 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:\windows\system32\reagent.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 id="{00000000-0000-0000-0000-000000000000}"/>
<WinreLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
<ImageLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
<OsInstallLocation path="\OKRbackup\factory\" id="0" offset="728680628224" guid="{f0ea3b1a-8657-4f56-abd1-dfea687a2d2f}" index="1"/>
<CustomImageLocation path="" id="0" 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>



Save the file and close WordPad.

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

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:

  • 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
  • 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.
  • Windows 7 only: If you have a standard Windows 7 installation DVD or USB flash drive you can mount the Install.wim file and copy out the Winre.wim file.
  • 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.
  • Mount the Install.wim file to the mount point. In this example, D: is the DVD drive. Command should all be on one line.
    dism /Mount-Wim /WimFile:"D:\sources\install.wim"
    /index:2 /MountDir:"E:\Win7-Install" /readonly


    The mount may take several minutes to complete.
  • Browse to the E:\Win7-Install\Windows\System32\Recovery 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

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.