Skip to main content

Guide for Adding MustangPE to the Windows 10 Graphical Recovery Screen

Thread needs solution

I prefer to do imaging from a boot environment and I prefer not to install TI on my machine. That's just my personal preference. Instead I use MustangPE as a boot environment to run Acronis True Image and Disk Director and do imaging and restoration from the boot disk. See this post for instructions on creating MustangPE: https://forum.acronis.com/forum/71918. If you have similar preferences and are a user of MustangPE then I would like to describe a method that I recently implemented that enables MustangPE to be started from the Windows 10 GUI without needing to boot from a flash drive or CD. If you don't use MustangPE, this process will work for any other version of WinPE including the WinPE-based Acronis recovery disk.

Doing this with Legacy boot PCs using BIOS and MBR partitions was straightforward; just install Grub4DOS to the MBR as a boot manager, copy the MustangPE ISO file to the hard disk, then boot the ISO file from the Grub4DOS menu. I used that method for several years but recently switched my PCs from Legacy boot to UEFI Boot and I wanted a way to do this seamlessly without fiddling with boot settings or disabling Secure Boot and without needing an external flash drive or CD.

On my machines, UEFI booting from a flash drive is hit or miss. You can't simply plug in a flash drive and select it from the Windows 10 Recovery screen and then boot the flash drive. For the flash drive to even appear in the list of devices on the Recovery screen it must be connected when the machine restarts. So you have to plug in the drive, restart the PC, wait for Windows to boot up, go to the Recovery screen, select the flash drive device, then reboot again. Or, reboot and press F12 at the right moment to access the boot order menu. This is somewhat inconvenient.

It's more convenient to use the Windows 10 Recovery GUI screens for booting into the Windows Recovery Environment or into other operating systems. MustangPE or WinPE are operating systems that can be booted exactly the same way as Windows Recovery Environment. They both boot from a .wim file, so you can just add one object to the BCD to add Mustang PE to the GUI screens. Here's how it looks to the user. From Windows you click on Settings and choose "Update & Security".
<photo 1>
On the next screen click on "Recovery", then on "Restart now".
<photo 2>
The next screen lets you select among several options, one of them is "Use another operating system".
<photo 3>
MustangPE appears as one of the OS choices on the next screen.
<photo 4>
After selection, the PC reboots into MustangPE in UEFI secure boot mode.
<photos 5 and 6>

Here's an overview of the procedure. One file (boot.wim) from the MustangPE flash drive is added to your disk and the BCD is edited to add one new object that boots MustangPE. The object is similar to the one that boot Windows Recovery Environment. To figure out how to create the new BCD object, start by examining the existing one that boots WinRE.

The bcd objects that boot Windows Recovery Environment look like this when you view the BCD from the recovery environment. I've assigned drive letter T: to the RE Tools partition temporarily to make the output more human-friendly. Note that {GUIDs} will be unique on different systems, so I'm representing them here as {GUID n} instead of by their 32 hex digit identifiers like {7c2d7922-5429-11e6-8345-3417eb97bf79}:

Windows Boot Loader
-------------------
identifier              {GUID 1}
device                  ramdisk=[T:]\Recovery\WindowsRE\Winre.wim,{GUID 2}
path                    \windows\system32\winload.efi
description             Windows Recovery Environment
locale                  en-US
inherit                 {bootloadersettings}
displaymessage          Recovery
badmemoryaccess         Yes
osdevice                ramdisk=[T:]\Recovery\WindowsRE\Winre.wim,{GUID 2}
systemroot              \windows
nx                      OptIn
bootmenupolicy          Standard
winpe                   Yes

 

Device options
--------------
identifier              {GUID 2}
description             Windows Recovery Ramdisk Settings
badmemoryaccess         Yes
ramdisksdidevice        partition=T:
ramdisksdipath          \Recovery\WindowsRE\boot.sdi

Note that only two files are needed to boot the Windows Recovery Environment; WinRE.wim and boot.sdi. These files are on the RE Tools partition on my system. I thought that to be a good location for the file needed to boot Mustang PE also, but you can put the file anywhere.

===========================================================

To create the new bcd object for Mustang PE, examine the existing bcd objects on a MustangPE flash drive while booted to the drive:

Windows Boot Loader
-------------------
identifier              {default}
device                  ramdisk=[boot]\sources\boot.wim,{GUID 3}
path                    \windows\system32\boot\winload.efi
description             Windows Setup
locale                  en-US
inherit                 {bootloadersettings}
testsigning             Yes    **You can try adding this but Secure Boot policy may prevent it or will remove it when you reboot**
isolatedcontext         Yes
osdevice                ramdisk=[boot]\sources\boot.wim,{GUID 3}
systemroot              \windows
bootmenupolicy          Standard
detecthal               Yes
winpe                   Yes
ems                     No

Device options
--------------
identifier              {GUID 3}
ramdisksdidevice        boot
ramdisksdipath          \boot\boot.sdi

Again, note that only two files from the flash drive are needed to boot MustangPE; boot.wim and boot.sdi. Conveniently, all versions of WinPE use the same boot.sdi file. You already have this file on your disk, so you only need the boot.wim file from the MustangPE flash drive.

==============================================================

After comparing the two sets of bcd objects, here is the additional bcd object that I added to my Windows 10 BCD to boot MustangPE:

Windows Boot Loader
-------------------
identifier              {GUID 4}    **This is the added (new) GUID**
device                  ramdisk=[T:]\MustangPE\boot.wim,{GUID 2}
path                    \windows\system32\boot\winload.efi
description             Mustang PE
locale                  en-US
inherit                 {bootloadersettings}
badmemoryaccess         Yes
isolatedcontext         Yes
osdevice                ramdisk=[T:]\MustangPE\boot.wim,{GUID 2}
systemroot              \windows
nx                      OptIn
bootmenupolicy          Standard
detecthal               Yes
winpe                   Yes
ems                     No

It's also necessary to add an entry to the Windows Boot Manager bcd object that points to {GUID 4}. This adds MustangPE to the Windows 10 boot menu:

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
badmemoryaccess         Yes
default                 {current}
resumeobject            {GUID 5}
displayorder            {current}    **Existing entry to boot Windows 10**
                        {GUID 4}    **Added entry to boot MustangPE**
toolsdisplayorder       {memdiag}
timeout                 2

Here's the implementation procedure. This procedure is intended for the technically advanced user who is comfortable editing the BCD:

1. Decide where to put the file boot.wim from a working MustangPE flash drive. It can go anywhere on your disk(s). I chose to put it in the RE Tools partition instead of the Windows partition so that it is protected from accidental deletion. This is a more involved procedure so you may decide to take the easy route and just put it on your C: drive. My RE Tools partition (partition #4) was 450 MB with insufficient space for the boot.wim file, so first I had to make the partition larger. I chose to enlarge it to 2 GB to contain a 308 MB WinRE.wim and a 468 MB boot.wim while still allowing the recommended 1 GB of free space for VSS backups to occur. To do this, boot to MustangPE, start DD 12, shrink the adjacent Windows partition (partition #3) then move the RE Tools partition to the left and enlarge it to 2 GB. If you don't have DD 12 then copy all of the files in the Recovery partition to temporary storage, use DiskPart to shrink the Windows partition, then delete and re-create the RE Tools partition, then copy the files back from temporary storage.

2. Before adding the MustangPE boot.wim file use Diskpart to assign a drive letter to the RE Tools partition so that it is visible. I used T: for the drive letter as you can see in the above BCD objects. You can do this while booted to MustangPE or from Windows. Skip doing this if you're adding the file to a partition that already has a drive letter. Create a folder on the partition named "MustangPE" and copy boot.wim on the flash drive to the MustangPE folder. Set the file attributes on the MustangPE folder and its contents to Hidden, System, and not indexed (from the command prompt, +H +S +I) for additional protection against accidental deletion.

3. Edit the BCD. If you aren't comfortable doing BCD editing then consider getting a copy of EasyBCD. I won't supply the detailed bcdedit commands but here is an outline. Wherever you put the MustangPE file you'll find that editing the BCD is easier to do if you have a drive letter assigned to the partition so that you can refer to the locations by drive letter. This isn't an issue if your chosen location already has a drive letter.

4. Make a backup copy of your existing BCD. This is your insurance policy in case something goes wrong. Type "bcdedit /export /?" in a command prompt window to see the syntax.

5. Make a duplicate copy of the existing Windows Boot Loader object for WinRE. Type "bcdedit /copy /? to see the syntax for creating a copy. The copy will be assigned a new {GUID} by the bcdedit copy command. In this article I'm referring to this as {GUID4}.

6. Edit your copy to correspond to the new bcd object as shown above. This copy will become your new Mustang PE bcd object. Type "bcdedit /set /?" for syntax.

7. Finally, add an entry in the Windows Boot Manager object for your new MustangPE Boot Loader.

I've attached a copy of my modified BCD as an example. Remember that the {GUIDs} on your system will be unique and different and that you may have different locations for the boot.wim and boot.sdi files.

Once finished, remove the temporary drive letter from the RE Tools partition (if you did this) and reboot to test. If you get things really messed up you can use bcdedit to restore the backup copy you made of the original bcd. Type "bcdedit /import /?" to see the syntax.

Once you get this working, change the timeout value in the Windows 10 GUI to 2 seconds so that the boot menu is visible for a shorter length of time. Go to Control Panel > View Advanced System Settings > Advanced tab > Startup and Recovery > Settings to do this or use bcdedit to change the "timeout" parameter in the Windows Boot Manager object.

I'd be interested in hearing from anyone who does this. It should also be possible to add more than one .wim-based recovery image to the disk and be able to boot into any of your favorite WinPE-based recovery environments.

 

Attachment Size
picture1.jpg 83.72 KB
picture_2.jpg 85.92 KB
picture_3.jpg 34.98 KB
picture_4.jpg 87.66 KB
picture_5.jpg 115.89 KB
picture_6.jpg 62.39 KB
newbcd.txt 5.97 KB
0 Users found this helpful

Mark,

Very good work. I'll give it try when I get more time. I'll try it with leaving the MustangPE files in my Windows partition. My boot.wim file has grown to be over a GB, so putting it in the Recovery partition is not such a good idea.

Paul:

I did the same on the last two computers in the house. It even worked perfectly on my Surface 3 tablet, which is very fussy about what it will allow to boot. You can install the files anywhere and since you have a flash drive to boot from in emergencies, there really isn't a need to put them on the recovery partition.

With a UEFI machine and the boot.wim file resident on an SSD, MustangPE boots extremely fast. And being able to access it from the GUI is very convenient.

I just realized that the boot.sdi file is just an empty Ramdisk image and is the same on all versions of WinPE. Therefore, it already exists on your disk. So only the boot.wim file from MustangPE is needed. Additionally, editing the BCD is easier since only one new bcd object is needed. I've updated the original post to reflect this.

This will make updating to future versions of MustangPE or WinPE easier since all you will have to do is copy the new boot.wim file to your disk. No other changes should be necessary.