3

I want to add a WinPE automated recovery partition to a computer, can this boot option be added to "Advanced boot options"? (Like where Safe mode options are).

4 Answers 4

4

You can set any loader to be launched from "Repair Your Computer" in Advanced Boot Options [ABO]; check ReAgentC for adding WinPE to ABO.

Visual BCD Editor allows replacing/setting any loader as Recovery loader:

  1. You need 2 entries [elements] in the main Windows loader:
    1. RecoverySequence: GUID of loader to be launched for recovery
    2. AutoRecoveryEnabled: Set to 1 or yes/true Windows 7 loader
  2. A recovery loader is a normal NT6 loader (Vista, 7, 8):
    1. WinPEMode:true
    2. RecoveryOs: true Windows 7 Recovery loader
2
  • Where I can download Visual BCD Editor 0.9.4 or later version? I can't find them on your website, only older releases are available. Can you give a private temp link? Thanks for the very useful tool!
    – sambul35
    Oct 3, 2016 at 1:39
  • 2
    You can't download 0.9.4 now as I am still developing and testing it, sorry. Older versions can fulfill the proposed solution. A recovery loader should be linked through RecoverySequence. The recovery loader itself should specify element "RecoveryOs".
    – snayob
    Oct 3, 2016 at 7:23
1

Usually Advanced Recovery options are present in Win8 and newer OS Advanced Boot Options, accessible in Shutdown Options with Shift+Restart. However, if you restored a backup system drive to a new disk or similar, the Recovery options may be missing. If the hidden Recovery Partition is still visible in Disk Management Console, you can restore Recovery options in Admin Command Prompt:

Reagentc /info     (output: "Recovery partition is Disabled")
Reagentc /enable   (if still don't see Recovery Options in Advanced Boot Menu, continue)   
diskpart
list volume
select volume 2    (it's often marked 450-512MB Hidden)
set id=07          (mark it as regular NTFS data volume on MBR disk)
OR: set id=07 override
OR: set id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7   (mark it as NTFS data volume on GPT disk)
assign letter=E    (OR: first run *list volume* and *select volume* again to see if its changed)
exit               (exit Diskpart, or reboot and re-open Admin CMD)
Reagentc /info
Reagentc /enable   (if no success in Boot Menu, run: *Reagentc /setreimage /path E:\Recovery\WindowsRE* )
diskpart
list volume
select volume 2
remove letter=E
set id=27          (mark the volume back as Hidden Recovery Partition on MBR disk)
OR: set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac   (mark it back as Hidden Recovery Partition on GPT disk)
exit

Close Cmd Prompt and open Disk Management Console to see, the Recovery partition is still present and marked Hidden. Now right mouse click on Windows icon in Taskbar -> Shut Down or Sign Out -> Shift + Restart. It will open Windows Boot Menu, and you can verify that a range of Recovery Options is now restored and available from the Menu. Select Boot to Command Prompt and reboot to test, if they work.

If your Recovery Partition is missing altogether in Disk Management Console, boot to Windows 10 Installation disk or use other methods to Restore Windows Recovery Environment.

1

Adding a boot option to the WinRE Boot Options Menu can be accomplished by using the existing WinRE.wim, copying and customizing it, or by creating a custom WinRE.wim (resultant custom WinRE.wim would then be added as an additional boot option):

  1. Customize WinRE:
    Installation of WinPE's development files are a prerequisite
  2. Add a Custom Tool to the WinRE Boot Options Menu
    1. Extract and mount a Windows install.wim and its winre.wim:
      # Create Required Directories:
        Md "C:\Mount\WIM" "C:\Mount\WinRE"
      
      # Copy Install.wim:
        Xcopy "Z:\sources\install.wim" "C:\Mount"
      
      # Get applicable OS' index:
        Dism /Get-ImageInfo /ImageFile:"C:\Mount\install.wim"
      
      # Mount applicable OS's index:
        Dism /Mount-Image /ImageFile:"C:\Mount\install.wim" /Index:6 /MountDir:"C:\Mount\WIM"
      
      # Mount WinRE.wim:
        Dism /Mount-Image /ImageFile:"C:\Mount\WIM\Windows\System32\Recovery\winre.wim" /Index:1 /MountDir:"C:\Mount\WinRE"
      
    2. Specify the custom tool’s filename and any parameters in C:\Mount\WinREConfig.xml:
      (only one custom tool can be added to the WinRE Boot Options Menu)
      <?xml version="1.0" encoding="utf-8"?>
      
      <!-- !!! This config MUST be encoded as UTF-8, not ANSI !!! -->
      
      <!-- WinREConfig.xml -->
      <Recovery>
        <RecoveryTools>
          <RelativeFilePath>OEMDiagnostics.exe</RelativeFilePath>
          <CommandLineParam>/param1 /param2</CommandLineParam>
        </RecoveryTools>
      </Recovery>
      
      • Custom tool: C:\Tools\OEMDiagnostics.exe
        Paramaters: /param1 | /param2
    3. Copy custom tool and its config file to C:\Mount\WinRE\Sources\Recovery\Tools:
      # Create Directory:
        Md "C:\Mount\WinRE\Sources\Recovery\Tools"
      
      # Copy Files and Directories:
        Copy "C:\Tools\OEMDiagnostics.exe" "C:\Mount\WinRE\Sources\Recovery\Tools"
        Copy "C:\mount\WinREConfig.xml" "C:\Mount\WinRE\Sources\Recovery\Tools"
      
      • Custom tool and any associated folders must be in this directory, allowing it to continue to work after future WinRE upgrades/updates
    4. Commit customizations and unmount the WinRE image:
      (same WinRE.wim can often be used in multiple images)
      # Unmount WinRE.wim:
        Dism /Unmount-Image /MountDir:"C:\Mount\WinRE" /Commit
      
      # Create a Backup:
        Copy "C:\Mount\WIM\Windows\System32\Recovery\winre.wim" "C:\Mount\winre_custom.bak.wim"
      
    5. Unmount and save the changes to the base Windows install.wim:
      Dism /Unmount-Image /MountDir:"C:\Mount\WIM" /Commit
      

  3. Deploy Image:
    1. Create a config file describing the custom tool in the Boot Options Menu:
      (add descriptions for each supported language)
      <?xml version="1.0" encoding="utf-8"?>
      
      <!-- !!! This config MUST be encoded as UTF-8, not ANSI !!! -->
      
      <!-- AddDiagnosticsToolToBootMenu.xml -->
      <BootShell>
        <WinRETool locale="en-us">
          <Name>Fabrikam Utility</Name>
          <Description>Troubleshoot your Fabrikam PC</Description>
        </WinRETool>
      </BootShell>
      
      • For <Name> and <Description> to display correctly, limit values to ≤30 characters
    2. During image deployment, but after registering the custom WinRE boot image and the OS, the custom tool description must be registered:
      ReAgentc /SetBootShellLink /ConfigFile "Z:\Recovery\BootMenu\AddDiagnosticsToolToBootMenu.xml"
      

  4. Verify Custom Tool Appears in Boot Options Menu
    1. Restart PC, complete OOBE as an arbitrary user, then boot to Advanced Startup:
      • Windows 10: StartSettingsUpdate & Security → Recovery → Advanced StartupRestart Now
      • Windows 8: StartPC settingsGeneralAdvanced StartupRestart Now
    2. WinRE Boot Options Menu:
      1. Troubleshoot<Custom Tool Name> (i.e. Fabrikam Utility) → PC reboots
      2. Tool specified in the WinREConfig.xml <RecoveryTools> parameter loads
      3. Confirm custom tool works properly, close tool, then Continue to Windows
1

You can add your own BCD menu option using Easy BCD, which provides a convenient GUI, saving you from unnecessary technical details.

  1. Locate WinRE.wim:
    • Windows 7 has everything (Boot and System) on the same partition inside a hidden, Admin-only folder [%SystemDrive%\Recovery\<GUID>]
    • If there's a reserved partition, use diskpart:
      1. list partition (partition you need is marked as Recovery, say it's 2)
      2. select partition 2assign letter=r
      3. Open an admin command line without closing DiskPart:
        Xcopy /h "R:\Recovery\WindowsRE\Winre.wim" "C:" && Exit
        
      4. In DiskPart: remove letter=rexit

  2. Open EasyBCD and follow the sequence, ignoring the upper part [Operating Systems] Easy BCD menu sequence
    • Step 4: Put any descriptive text that suits you
    • Step 5: Go to the folder containing Winre.wim

You now have a new entry in your Boot Menu with the name from Step 4

7
  • I thought of removing it, but actually there was nothing incorrect in the paragraph. I think to downvote an answer just for that is exaggerated and coercive.
    – cdlvcdlv
    Aug 10, 2019 at 21:25
  • I'm not being coercive, as I believe if you're going to downvote someone's answer, you should not only provide them with the reason for the downvote but also provide them the opportunity to correct what's wrong in the answer, and if corrected, make known the downvote will be removed. Specific to your answer: From a practicality and efficiency standpoint, if Windows natively provides (i.e. includes it by default) the tools to solve a Windows-specific problem, booting to a Linux LiveCD should not be the answer. It's the equivalent of booting to FreeBSD to solve an Ubuntu-specific issue.
    – JW0914
    Aug 10, 2019 at 22:03
  • Please provide a link to the rules of SU that supports your assertion that, not being a requirement of the question, it's forbidden to use Linux in Windows questions. Otherwise, my answer was better before (since gave more ways to do the task). And, yes, your comment meant "do what I like or I'll keep my downvote". What you like, because it's not in the rules unless you prove it.
    – cdlvcdlv
    Aug 11, 2019 at 11:06
  • Please re-read what I wrote. There's a plethora of ways to solve any one issue, w/ a few being vastly more relevant & efficient than most. Advising a user to utilize a Linux LiveCD/USB to accomplish what's possible via diskpart is inefficient and contextually-lacking advise. Efficiency matters and it takes all of 30s to perform the required changes via diskpart, versus 5m+ for a Linux LiveCD/USB, making it an inconvenience. While GParted will solve what's trying to be accomplished, It's an unnecessary & inefficient step that over-complicates a simple procedure Windows natively supports.
    – JW0914
    Aug 11, 2019 at 16:09
  • Hey, I hear you, but you shouldn't impose your rules by force. If you think your own believes about "practicality and efficiency" should be for everybody, open a suggestion in meta in order to include that to the rules. You cannot impose rules in SE at your wish and shouldn't downvote to remove anything useful according to your own preferences. Linux wasn't excluded by the OP and that paragraph was legit and informative (not for you, I take that). Well, you should be happy of your censorship. (I just saw you changed your comment while writing this. Sigh... I quit.)
    – cdlvcdlv
    Aug 11, 2019 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .