Windows Troubleshooting: Checking and Enabling Recovery Environment
Windows Recovery Environment (WinRE) is a built-in Windows tool that allows you to recover a system when it can’t be booted. WinRE can help you with troubleshooting when the system fails to start or unexpectedly restarts. Such issues might be caused by disk corruption, incorrect updates, or damaged or accidentally removed system files. WinRE repairs the system, bringing it back to a working state.
To create the recovery environment, Windows prepares the hard drive partitions during setup. Initially, the OS places the WinRE image file (winre.wim) in the Windows partition, \Windows\System32\Recovery folder. In the configuration step, the WinRE image file is copied to the recovery tools partition, so that you’ll be able to use the recovery environment even if the Windows partition is damaged.
When restoring an image in a bootable ISO/USB environment partition-by-partition, the WinRE partition is not vital and can be excluded. However, WinRE is needed for automatic repairs, troubleshooting and/or system image recovery, so it must be checked and (if needed) reconfigured after the system successfully boots up – to avoid potential problems.
A tool called REAgentC will help to check whether Windows Recovery Environment is ready to work. Use the following command (from an elevated command prompt or Windows PowerShell):
If the recovery environment is configured correctly, the output of the command will contain the following line:
Windows RE status: Enabled
If the status is Disabled, then you need to reconfigure the WinRE partition.
How to Configure Windows Recovery Environment
Please note: the recovery environment can be located on the system drive, but it’s better to move it to a separate unencrypted (in the case of BitLocker) partition. Otherwise, you might encounter problems in the event of a blocked or ransomware-corrupted system drive.
Create a new NTFS partition after the C: partition or at the end of the drive for WinRE. By default, Microsoft recommends allocating 650 Mb for it. The WinRE image (winre.wim) should be placed in the \Recovery\WindowsRE folder of the partition you’ve just created.
Note: if the winre.wim (or WinRE partition) was not included in the image-based backup, it can be extracted from the Windows Setup image: \sources\install.wim/[*]/Windows/System32/Recovery/, where [*] is an index number of the Windows edition included in install.wim. Use the DISM tool to determine the right folder.
Next, configure and enable Windows Recovery Environment. Run the following commands (the partition with the winre.wim image in this example is the R: drive):
reagentc /setreimage /path R:\Recovery\WindowsRE
You can get more options for the REAgentC tool via the link below:
After WinRE is enabled, you need to customize some attributes for the recovery partition. Use the diskpart tool:
select disk 0
select partition 4
select disk 0
select partition 3
In these examples, the system disk is 0 and the recovery partition is 4 (UEFI) or 3 (BIOS). To check what disk and partition to select, use the commands list disk and list partition respectively.
Note: after Windows 10 updates, there might exist 2 recovery partitions – at the beginning of the disk and after the system partition. The first one is enabled for BCD and redirects to the second one, and the second recovery partition holds the winre.wim image. In this case, the instructions above will help to reconfigure the WinRE partition to result in one partition only.
Once you’ve configured Windows Recovery Environment, it is ready to be used to troubleshoot the issues of an unbootable OS. You can launch it from the Boot Options menu. Here’s how Microsoft recommends doing it:
- From the login screen, click Shutdown, then hold down the Shift key while selecting Restart.
- In Windows 10, select Start > Settings > Update & Security > Recovery; under Advanced start-up, click Restart now.
- Boot to recovery media.
- Use a hardware recovery button (or button combination) configured by the OEM.