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 Answers4

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
JW0914
  • 9,096
snayob
  • 4,500
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.

sambul35
  • 121
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

JW0914
  • 9,096
cdlvcdlv
  • 1,739
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
JW0914
  • 9,096