RE Pre-Install IssuesEdit
Figure B: Checking the status of the Recovery Environment. The display shows that it is enabled, and that the location of the file is hidden partition four, the usual recovery partition. That is to say, all is well.
Figure C: Shows a typical command prompt output while searching for RE files. Notice that the working file is not listed, the one currently in the recovery partition.
RE Management with Windows ExplorerEdit
Although enabling and disabling the RE must be done at the Command Prompt, searching for files can always be done from within Windows Explorer. If work needs to be done directly in the recovery partition however, a drive letter will need to be assigned. (See later). For some actions that will not be necessary. In general, the user should consider logging on as an administrator, and in any case adjust the folder options as follows:
- Go to Windows Explorer's View drop menu.
- Select the Options tile, then Change folder and search options.
- In the dialog that opens, select the View tab, then check Show hidden files, folders and drives. In addition, ensure that the Hide protected operating system files (Recommended) remains unchecked.
- Click Apply then OK to quit the dialog.
Search for filesEdit
Left-click the C: drive in the left panel then enter the file name and extension in the top-right Search This PC text field, (for example, winre.wim ). Hit Enter to start the search of C: drive. After a while the results list will be completed. Narrow or widen the search locations by choosing a different drive or folder in the left panel, then re-entering the file details.
Being able to see system and operating files does not necessarily mean that they can be moved or copied. That privilege depends on who the owner is. In the event of such difficulty, the intending user might have to take ownership of such a file or folder, or extend sharing to himself. Use the right-click menu item "Give access to", to give yourself access to some restricted files.
Hidden Partition WorkingEdit
Before installing the RE in a partition, the system checks to see if the partition is suitable. During the install run, it checks for size and type, and otherwise decides on suitability. If it decides that it is too small for the files and working space, or otherwise unsuitable, it will install the RE into the C:\Recovery folder instead. So, if at any time the RE is found in that folder, it would be best to consider any issues with the partition before attempting to install in it. Microsoft's page on this issue is best, at Disk partition requirement for using Windows RE tools on a UEFI-based computer.
If it is decided to extend the partition, or to work on it, the use of a partition tool is preferred. Even free utilities such as MiniTool Partition Wizard Free Edition permit the assignment of drive letters and the adjustment of a partition's size. They also allow the viewing of files in hidden partitions, using an explore option. These utilities are often simpler to use than those supplied by Windows, but on a cautious note, care is needed in any partition tool's use, since changes made in a casual way can have far reaching consequences.
In order to see and work with any files in a hidden partition, a drive letter must first be assigned. Then the files can be handled in Windows Explorer, in the same way as any others. After a session of work is done, the drive letter can be removed again to make it inaccessible. Before working on any system files, it is advised to set the folder options of Windows Explorer so that system files will be visible and so that operating system files are not hidden. Otherwise, they will be invisible for both viewing and command prompt listings. Similarly, any use of the command prompt should be done at an Admin level, the so-called elevated command prompt, or some commands will not work at all. It might also be as well to sign on to Windows as an administrator for any extended work. This will minimise the requests for permissions.
Making Clean Starting FoldersEdit
Figure D: Shows the changes in file locations when the RE is enabled and disabled. When enabled
, The Winre.wim
file in the staging location is moved, with other files, to its working location in the recovery partition. It is moved back when disabled
When attempting to make a clean installation of the RE, it is important to avoid any residual problems that exist in the surrounding files and folders. One way, when it is possible, is to install into empty folders made for the purpose, and to first rename any similar existing folders so that they are unavailable. For example, for a partition, the RE system will install into a specific folder in a specific folder tree, and no other. For a clean installation, the partition must have an empty outer folder in it called Recovery. Within the Recovery folder there must be another empty folder called WindowsRE. If any existing folder tree exists with the Recovery name it should be renamed so that it is unavailable.
Similarly, during the installation of the RE, a Winre.wim image file must initially be located in folder C:\Windows\System32\Recovery. There is no need for any WindowsRE folder at this location, since it is merely a staging location for the wim file, prior to the start of the installation. If there is doubt as to the integrity of the Winre.wim file, then it too should be renamed, and another file that is known to work, brought in to replace it. In Windows 10 and beyond, some files are made automatically when they are not found during an RE installation run. This is not the case for earlier Windows editions. For Windows 10 and 11, this makes it a useful way to exclude such files from adversely affecting the new installation. If there is an existing REAgent.xml file in the C:\Windows\System32\Recovery folder, it must be deleted before a clean install; the system will make a new one on-the-fly, with all of the new configurations in it. Note that a missing Winre.wim file will not be replaced during a run; it must be present at the staging point before enabling the RE.
Checking System Files and ImagesEdit
At any time, the integrity of the system can be checked by running a file check. That does not mean that the recovery partition will be checked as well. When the RE is disabled, the Winre.wim file is brought back into the C:\Windows\System32\Recovery folder, regardless of where it was located while it was enabled. So prior to running a specific file check it would be best to make sure that the Winre.wim file is conveniently located in Windows, by first disabling the RE. Code for doing this, and other tests, is given in a later section, though recent tests have introduced doubt as to whether or not the Winre.wim file is ever included in a System File Check; no mention of it is ever found in the various logs.
An alternative to file checking is to make use of a Winre.wim file from a known, good Windows computer of the same edition. Another alternative is to allow the computer to do a features update, or an upgrade of Windows. Because the system needs the RE for its updates, it will make sure that there is a working RE by the time it is done. That is not to say that the system will install the RE where you want it; it will not install it into a partition if it was not notified (set) there before. Another way, more complex, to get a file is to mount an installation image so that there is access to its files. The wim file can then be copied, and dismounted after use.
Microsoft recommends running DISM before sfc in Windows 10, so this is the sequence displayed below. The following code can be used at an elevated command prompt to perform more searching tests and repairs on the computer, but should be used sparingly and with caution, in view of the damage that might result from careless use:
To check the Windows image for integrityEdit
The code lines shown here require an online internet connection. They check the Windows files against a reference set of files in a Microsoft server. The first line will check that files are OK without making changes, while the second line will check the integrity of the component store. The third and most useful will check and fix any bad files that are found. The process can take some time since many files need to be checked.
Press Enter after any one line of code, then await completion before any other:
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
To perform system file tests and repairsEdit
The first of these two code lines will verify the integrity of the system files but will not make any changes to them. The second line will check such files and also repair or replace them as necessary. A log file for the process is available at C:\Windows\Logs\CBS\CBS.log.
Press Enter after any one line of code, then await completion before any other:.
To perform hard drive sector tests and repairsEdit
The first of these two code lines will verify the integrity of C: drive's sectors, and will report but not make any changes to them. The second line will check the sectors and also make repairs as necessary.
Press Enter after any one line of code, then await completion before any other:
chkdsk /r c:
chkdsk /f c:
To obtain a hash for your working Winre.wim fileEdit
There is no clear evidence that the wim file is ever checked during a sfc check, so the next best thing is to do a hash of your wim file while it is working well so that you can compare it when it is in doubt. The procedure below first disables the RE to move the wim file into Windows. Then the directory is changed to the folder that contains the wim file, then the hash line is run. Change the MD5 to SHA1, SHA256, or SHA512 for other hashes. The sequence of work is just:
Press Enter after each line of code, then await completion before any other:
certutil -hashfile winre.wim MD5
To Check, Enable or Disable the REEdit
At various times we need to disable or enable the Windows Recovery Environment. When disabled, there is no access to the advanced options of the RE without a Recovery Drive, and it is not possible to make such a drive when the RE is disabled. However, at times when repairing the RE, we need to switch it off and on. These commands, as for many others, must be made at an administrator command prompt.
- The RE status tells us whether it is currently enabled or disabled, (see Figure B), and if enabled, what its set location path is. It is found with: