WinRE: So is there any good way to get MDT to place any form of WinRE on a partition other than C:?


This question was asked by Joe Zeppy.  The answer depends on a few things

  • Operating System being deployed
  • Partitions that are being used
  • Size of the Partitions
  • BIOS or UEFI

Windows 8, Windows 8.1, and Windows 10

If you are deploying Windows 8, Windows 8.1, and Windows 10, WinRE.wim will automatically place WinRE.wim in the following locations:

Single Partition Deployments – There is no other options but to place WinRE.wim on C: since this is the only drive, which should be Partition 1.

BIOS with System Partition – WinRE.wim will be placed on the System Partition, which should be Partition 1.  This assume there is enough space on the System Partition.  If not, it will be on the C: Partition

UEFI with Recovery Partition – When deployed with MDT 2013 Update 1 (R2), a UEFI system will have an EFI System Partition (1), an MST Partition (2), Windows Partition (3), and Recovery Partition (4).  In this case WinRE.wim will automatically be placed on the Recovery Partition (4).  Prior version of MDT created a Recovery Partition at the beginning of the drive.  In these cases, WinRE.wim would be in the Recovery Partition (1).  This assumes that there is enough space on the Recovery Partition.  If not, WinRE.wim will be on C:, except in the case of Windows 10, which will create an additional Recovery Partition.

So as long as your Partitions are set properly there is nothing you need to do.


Windows 7

Windows 7 doesn’t work properly.

BIOS with System Partition – In the case, MDT 2013 Update 1 (R2) will create 3 Partitions, a 499MB System Partition, a Windows Partition, and a Recovery Partition.

2015-11-09_21-53-17

Upon reboot from WinPE, even with a proper System and Recovery Partition, WinRE.wim will be at C: in C:\Recovery\%BCDID%\WinRE.wim

2015-11-09_22-07-26


Proper WinRE.wim in Windows 7 for BIOS Deployments

You will need to make a few changes.  First in your Task Sequence, fix the Partitions.  You don’t need 3 Partitions, only 2 (you can use this configuration for BIOS Windows 8, Windows 8.1, and Windows 10 as well.

2015-11-09_22-13-29

2015-11-09_22-14-11

Additionally before Windows 7 restarts from WinPE, you should copy or move WinRE.wim to where you want it to be.  In the screenshot below I placed it on my System Partition at Recovery\WindowsRE\WinRE.wim

2015-11-09_22-21-14

Additionally you will have to edit C:\Windows\System32\Recovery\WinRE.xml to read the following (BootKey is optional).

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version="1.0">
<WinreBCD id="{00000000-0000-0000-0000-000000000000}"/>
<WinreLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
<ImageLocation path="\Recovery\WindowsRE" id="" offset="1048576" guid="{00000000-0000-0000-0000-000000000000}"/>
<OsInstallLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
<InstallState state="0"/>
<OsInstallAvailable state="0"/>
<WinREStaged state="1"/>
<OperationParam path=""/>
<OsBuildVersion path=""/>
<OemTool state="0"/>
<BootKey state="34048"/>
<IsServer state="0"/>
<ScheduledOperation state="4"/>
</WindowsRE>

Yeah this looks right.  Now reboot from WinPE

2015-11-09_22-33-08

The most important thing to know if the ImageLocation Offset.  Setting it to the value of “1048576” tells Windows Setup that WinRE is in the Partition starting at this offset.  Which if you take 1048576 and divide by 1024, you get . . . . 1024, which is the Partition starting at 1024 KB (the original value was in Bytes).  Understanding this, if you want to place WinRE somewhere else, you need to know the offset of the Partition in Bytes.

And after reboot, WinRE is in the System Partition

2015-11-09_23-14-17


UninstallWindowsRE Method

Additionally you can add the UninstallWindowsRE setting in your Unattend.xml in <settings pass=”oobeSystem”>

<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UninstallWindowsRE>true</UninstallWindowsRE>
</component>

And after WinPE has rebooted to Windows, you will no longer have a C:\Windows\System32\Recovery directory.  From there complete the following in the Task Sequence (this can be easily scripted).

  1. Use Diskpart to assign your System Partition a drive letter (S:)
    1. select disk 0
    2. select partition 1
    3. assign letter S
    4. exit
  2. Copy WinRE.wim from your Network Location (since it will not exist because of UninstallWindowsRE) to S:\Recovery\WindowsRE\WinRE.wim
  3. Run the following in a Command Prompt
    1. reagentc /setreimage /path S:\Recovery\WindowsRE\ /target C:\Windows
    2. reagentc /enable
  4. Use Diskpart to remove S:
    1. select disk 0
    2. select partition 1
    3. remove letter S
    4. exit

2015-11-09_23-56-25

All done.  You should be able to validate everything is working by typing reagentc /info in a command prompt.  Here is what my C:\Windows\System32\Recovery\ReAgent.xml looks using this method.  Keep in mind this was generated automatically and does not need to exist prior to running the commands above.

2015-11-10_0-01-05


You should be able to figure out Windows 7 UEFI using a similar method.  Hope this helps!


Update 11/11/2015

New script in the works that will Update WinRE with a custom WinRE.wim and enable WinRE in the proper Partition.  Screenshot of the log below:

2015-11-11_14-18-40