UnHide Windows 11 Recovery Partition and add application to WinRE.wim file and register WinRE.wim with reagentc command

Technical Level:; Advanced

Objectives :

1. Adding compatible portable applications like Hwinfo64.exe or Diskinfo64.exe ( any one application only) these two applications are fully compatible

with the WinRE.wim file and WinPE.wim file (boot.wim)

2. Creating AddDiagnosticsToolToBootMenu.xml file with encoding as UTF-8

3. Creating WinREConfig.xml file with encoding as UTF-8

Tools needed:

1. Dism application which is builtin on windows 11

2. Diskinfo64.exe portable application which is included in CrystalDiskInfo8_16_4.zip file, CrystalDiskInfo8_16_4.zip can be downloaded from here

and unzip the file.

3. Delete the following file from this folder "CrystalDiskInfo8_16_4"

diskinfo32.exe

diskinfoA64.exe

Steps to be followed :

1. Create WinREConfig.xml using notepad, I created it for you, open the notepad application copy and paste the below lines, and save it as

WinREConfig.xml to desktop. Use encoding as UTF-8.

<?xml version="1.0" encoding="utf-8"?>

<!-- WinREConfig.xml -->

<Recovery>

<RecoveryTools>

<RelativeFilePath>Diskinfo64.exe</RelativeFilePath>

</RecoveryTools>

</Recovery>

2. Create AddDiagnosticsToolToBootMenu.xml using notepad, I created it for you, open the notepad application copy and paste the below lines,

and save it as AddDiagnosticsToolToBootMenu.xml to desktop. Use encoding as UTF-8.

<?xml version="1.0" encoding="utf-8"?>

<!-- AddDiagnosticsToolToBootMenu.xml -->

<BootShell>

<WinRETool locale="en-us">

<Name>Crystal Disk Information App</Name>

<Description>Checking SMART Status on SSD and HDD</Description>

</WinRETool>

</BootShell>

3. Assign a drive letter to the Windows recovery partition, if windows 11 is installed by using a windows bootable USB pen drive.

if the recovery partition is created in a different partition and not in the Windows partition.

recovery partition 4 on disk no 2

Before unhiding the recovery partition, this does not show in my computer.

Execute command prompt application with administrator rights

type diskpart and press enter

list disk

sel disk 0 ( select no 0, if you using only one disk)

list par

sel par 4 ( see that partition is hidden and its format type as NTFS )

assign letter=R

exit

5. Disable the Recovery partition by using the below command. Execute command prompt application with admin rights

Reagentc.exe /disable

Now the Recovery partition is showing on my computer

6. Unhide the contents of the Recovery partition. Execute command prompt application with admin rights

attrib -h -r -s /s /d R:\Recovery\*.*

attrib -h -r -s /s /d R:\Recovery\WindowsRE\*.*

7. Create a new folder "WinRE_11_amd64" in C:\

7a. Create a new folder "Temp" in C:\

8. Create a new folder "media" in C:\WinRE_11_amd64\

9. Create new folder "sources" in C:\WinRE_11_amd64\media\

10. Copy the "WinRE.wim" file to C:\WinRE_11_amd64\media\sources\ and rename WinRE.wim to boot.wim

10a. For security purposes, backup this "WinRE.wim" file to the D: partition

11. Mount the "boot.wim" file. Execute command prompt application with admin rights.

Dism.exe /Mount-Image /ImageFile:"C:\WinRE_11_amd64\media\sources\boot.wim" /index:1 /MountDir:"C:\WinRE_11_amd64\mount" /Optimize /checkintegrity

12. Create new folder "tools" to C:\WinRE_11_amd64\mount\sources\recovery\

13. Copy "WinREConfig.xml" file to C:\WinRE_11_amd64\mount\sources\recovery\tools\

14. Copy "CdiResource" folder to C:\WinRE_11_amd64\mount\sources\recovery\tools\

15. Copy "License" folder to C:\WinRE_11_amd64\mount\sources\recovery\tools\

16. Copy "Diskinfo.ini" file to C:\WinRE_11_amd64\mount\sources\recovery\tools\

17. Copy "Diskinfo64.exe" file to C:\WinRE_11_amd64\mount\sources\recovery\tools\

18. Reducing the size of the Components in "boot.wim" file

Dism.exe /Cleanup-Image /Image:C:\WinRE_11_amd64\mount /StartComponentCleanup /Resetbase /ScratchDir:C:\Temp

19. Set Target path to X:\

Dism.exe /image:"C:\WinRE_11_amd64\mount" /Set-TargetPath:X:\

20. Unmount "boot.wim" file.

Dism.exe /UnMount-image /mountdir:C:\WinRE_11_amd64\mount /commit

21. Cleanup Cleanup-MountPoints from all partitions

Dism.exe /Cleanup-MountPoints

Dism.exe /Cleanup-Wim


22. Cleanup Mounted points registry keys

Reg.exe delete "HKLM\SOFTWARE\Microsoft\WimMount\Mounted Images" /f

23. Exporting image with verification and with integrity from "boot.wim" file,

Dism.exe /Export-Image /SourceImageFile:"C:\WinRE_11_amd64\media\sources\boot.wim" /SourceIndex:1 /DestinationImageFile:"C:\WinRE_11_amd64\media\sources\boot2.wim" /bootable /checkintegrity

24. Deleting unexported "boot.wim" file.

Del "C:\WinRE_11_amd64\media\sources\boot.wim"

25. Rename "boot2.wim" to "boot.wim" and Renaming "boot.wim" to "WinRE.wim"

Ren C:\WinRE_11_amd64\media\sources\boot2.wim boot.wim

Ren C:\WinRE_11_amd64\media\sources\boot.wim WinRE.wim

26. Create a new folder "bootmenu" in R:\Recovery\

27. Copy "AddDiagnosticsToolToBootMenu.xml" file to R:\Recovery\bootmenu\

28. Delete the old "WinRE.wim" file from R:\Recovery\WindowsRE\ using the command prompt application

del "R:\Recovery\WindowsRE\WinRE.wim"


29. Copy "WinRE.wim" file from C:\WinRE_11_amd64\media\sources\WinRE.wim to R:\Recovery\WindowsRE\

30. Register "WinRE.wim" to Windows Recovery Partition by using the Reagentc.exe application. Close all running applications in all partitions, temporarily disable windows defender and close all opened folders.

Execute command prompt application with admin rights.

Reagentc.exe /SetReImage /path R:\Recovery\WindowsRE /target C:\Windows

Reagentc.exe /SetBootShelllink /Configfile R:\Recovery\BootMenu\AddDiagnosticsToolToBootMenu.xml

Reagentc.exe /Enable /target C:\Windows

Reagentc.exe /Info /target C:\Windows

To test the modified WinRE.wim file, Click on the Settings icon, then click on System, then on Recovery, click on Advanced startup

Windows OS will boot into Recovery Environment mode.

I tested on my Windows 11 laptop, screenshots of testing

End Task.

Was this article helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this article?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this article?

Thanks for your feedback.

Thank you for your article. I had already been successful before but there is one thing I hope that you perhaps may have found an answer to: I would like to be able to enter a command with-in a running Windows and restart the computer and then have it automatically boot into WinRE and automatically run this custom tool. This would avoid having first go to Troubleshoot and then to start the tool manually. I get it to work by making "adjustments" to the Winpeshl.ini and/or the startnet.cmd inside WinRE, I however hope that there is another option that works without changing these or any other files.

ChatGPT came up with some great answers which used combinations of reagentc and bcdedit commands. But a few lines further down in the chat the bot unfortunately had to admit that it had been wrong. So I am putting my hope back on a human being. :-)

Was this comment helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this comment?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this comment?

Thanks for your feedback.

Thanks for your reply.

Adjustments is needed to add winpe supported applications inside winre.wim file.

To add application we need to add commands to XML file

I am working as a Mathematics lecturer in a PU college.
Windows11_Pro_64bit_23H2_buildno_22631.3593_MS.office365_C2R_2401_v17231.20236_Intel_i5_13500_Nvidia3060_12GB_GDDR6_RAM_32GB_5600_Storage8TB.

Was this comment helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this comment?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this comment?

Thanks for your feedback.

Hi Raju,

thank you for your reply. I of course do have an application installed within WinRE and it starts fine and similar to your Crystal Disk Information App. "My" application also is mentioned under Troubleshoot. In other words: All required xml-files exist in the correct location and are ok. However, currently if a user would like to run your or my app they would have to boot into WinRE, go to Troubleshoot and then to start my app.

Think of it like this:

Wouldn't it be much more comfortable for a user to just double click a shortcut/program or run a few commands (which could be added to a batch-file, so we again could make use of a shortcut) within Windows and then the computer automatically would reboot, boot into WinRE and start this app ?

Was this comment helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this comment?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this comment?

Thanks for your feedback.

That's possible, applications must be in portable format, users needs to copy app to any location of partition.

And run the command.

On my laptop I tested SLIM Browser to access information via recovery environment.

I am working as a Mathematics lecturer in a PU college.
Windows11_Pro_64bit_23H2_buildno_22631.3593_MS.office365_C2R_2401_v17231.20236_Intel_i5_13500_Nvidia3060_12GB_GDDR6_RAM_32GB_5600_Storage8TB.

Was this comment helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this comment?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this comment?

Thanks for your feedback.

As I have mentioned before the application is installed WITHIN WinRE. Meaning: After booting into WinRE it can be found in the folder X:\Sources\Recovery\Tools. Having to first copy it to another partition just to be able to execute it would be the opposite of making it easier for a user to start it.

Was this comment helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this comment?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this comment?

Thanks for your feedback.

 
 

Forum Article Info


Last updated January 16, 2024 Views 2,128 Applies to: