You can customize the user experience of Windows® RE to include additional diagnostic and troubleshooting tools, a recovery image compatible with Windows Setup, or a custom application to enable full-system recovery. These customizations require creating an XML file called WinREConfig.xml.

Recovery Control Panel

In Windows® 7, users can initiate an image recovery without having to first start Windows RE manually. The Recovery control panel guides users through backing up their personal data, and it then restarts the system into Windows RE, where the image-recovery application is launched automatically.

To create a WinREConfig.xml file

  1. Create a Tools subdirectory in your working Windows RE directory. For example,

    \Sources\Recovery\Tools
    
  2. Create an .xml file called WinREConfig.xml by using the following syntax.

    <Recovery>
       <Server/>
    	<RecoveryTools>
    		 <RelativeFilePath> Tools.exe</RelativeFilePath>
    		 <CommandLineParam>/param1 /param2</CommandLineParam>
    		 <AdminOnly>No</AdminOnly>
    	</RecoveryTools>
    	<FactoryRecoveryTool>
    		 <RelativeFilePath> Tools.exe</RelativeFilePath>
    		 <CommandLineParam>/param1 /param2</CommandLineParam>
    		 <AdminOnly>No</AdminOnly>
    	</FactoryRecoveryTool>
    	<SupportTool AutoLaunch="Yes"/"No">
    		 <RelativeFilePath> Tools.exe</RelativeFilePath>
    	</SupportTool>
    	<CustomFrontEnd>
    		 <RelativeFilePath> Tools.exe</RelativeFilePath>
    		 <CommandLineParam>/param1 /param2</CommandLineParam>
    	</CustomFrontEnd>
    	<AlwaysAuthenticate/>
    	<NonAdminToolsOnly/>
    	<StartupRepair>
    		 <NoNetworking/>
    		 <NoAutoLaunchFromCD/>
    	</StartupRepair>
    </Recovery>
    
    Choose the customizations that you intend to enable, and include the corresponding elements in your WinREConfig.xml file. The following table describes these XML elements.

    Element Description

    Server

    Sets Windows RE to run in server mode. When specified, client-specific Windows RE options are not displayed. This setting is required when installing Windows RE on a server system.

    RecoveryTools

    Link to the customized recovery application to be included in the System Recovery Options menu. Only one application can be specified. The icon shown is extracted from the first available icon in the application executable file. The title and the description of the link are extracted from the Product name and File description attributes of the application executable file.

    SupportTool

    Denotes customized support or the diagnostic tool that can be launched from a link when Startup Repair is unable to repair the operating system. Only one tool can be specified.

    FactoryRecoveryTool

    If specified, the Reinstall Windows option on the Windows RE tools menu is replaced by the tool specified.

    AutoLaunch

    Automatically launches the tool specified in SupportTool when the value is set equal to Yes. This setting does not apply to cases when no startup failure is detected or a hardware error is detected.

    CustomFrontEnd

    Specifies an application to be launched instead of the Windows RE default user interface (UI), unless one of the following is true. Windows RE is launched:

    • From CD/DVD.

    • Automatically.

    • From the F8 menu.

    This application must set the registry value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\RecoveryEnvironment\TargetOS to the path of the Windows directory of Windows 7.

    This XML element is optional.

    RelativeFilePath

    The relative path from the \Tools subfolder of the folder in which Recenv.exe resides. For example, if Recenv.exe is located in X:\WinRE\, the path designated in this field is relative to X:\WinRE\tools.

    CommandLineParam

    Command-line parameters to be used in conjunction with the executable file specified under the <RelativeFilePath> element.

    AdminOnly

    Specifies whether the application should be shown only on the Windows RE tools menu when a user with local administrative privileges is logged on.

    AlwaysAuthenticate

    Authentication is enforced, regardless of the start location of Windows RE, including media. If the username/password database on the offline Windows operating system is corrupt or otherwise inaccessible, users will not be able to access the recovery tools in Windows RE.

    NonAdminToolsOnly

    Only Startup Repair and the application specified in <RecoveryTools> (if present) is accessible through the Recovery menu. All other options are hidden.

    StartupRepair

    Contains a list of Startup Repair-specific settings.

    NoNetworking

    Disables the sending of diagnostic and repair data to Microsoft. Startup Repair will not turn on networking after a failed repair attempt.

    NoAutoLaunchFromCD

    Prevents Windows RE from launching Startup Repair automatically when it is booted from optical media and a boot failure in the offline operating system has been detected.

  3. Save the file in your working Windows RE directory under \Sources\Recovery\Tools.

To configure a custom image-recovery tool

If you have a custom image-recovery tool, you can configure the Windows RE tools menu to launch the custom tool as well as from the Recovery control panel in Windows. The tool should follow these requirements:

  • All application files, such as .EXEs and .DLLs, are stored inside the Windows RE image (Winre.wim).

  • Once the application has completed all of its operations in Windows PE, it should not restart the system. Instead, it should terminate with the appropriate exit code as defined below:

    Exit Code Condition Windows RE Behavior After Custom Application Exits

    0

    Recovery completed successfully.

    The system is restarted automatically.

    1

    Recovery did not complete, but the system is expected to be usable. For example, the user cancels before the disk is formatted.

    If recovery is initiated from the Recovery page in Control Panel, the system is restarted automatically. If recovery is launched from the Windows RE tools list, the Windows RE tools list is displayed.

    Other

    Recovery did not complete and the system is expected to be unusable. For example, there is a failure during imaging after the disk has been formatted.

    The Windows RE tools list is displayed.

  1. Follow step 1 of Walkthrough: Create a Windows RE Image to extract the default Windows RE from a Windows 7 image onto the technician computer.

  2. Create the \Tools directory inside the mounted Windows RE image if it does not already exist. For example:

    mkdir C:\winre\mount\sources\recovery\Tools
    
  3. Copy all binaries required by the custom image-recovery tool to the \Tools directory.

  4. Launch Notepad.exe and type the following:

    <Recovery>
       <FactoryRecoveryTool>
    	<RelativeFilePath>path_to_exe</RelativeFilePath>
    	<CommandLineParam>parameter_1 parameter_2</CommandLineParam>
    	<AdminOnly>access_level</AdminOnly>
       </FactoryRecoveryTool>
    </Recovery>
    
    • path_to_exe -path of the tool’s launch executable file relative to the \Tools directory

    • parameter_n -command-line parameter to be used when the executable file is launched (for example, /formatdisk /restoreall).

    • access_level -Yes/No value. Specifies whether the imaging tool should be restricted to users with administrative privileges only from the Windows RE tools menu. This setting does not affect the Recovery control panel, which always requires administrative privilege to initiate an image restore.

  5. Save the text file as Winreconfig.xml under the \Tools folder of the mounted Windows RE image.

  6. Follow step 6 of Walkthrough: Create a Windows RE Image to save the Windows RE image.

  7. When deploying Windows to the destination computer, use REAgentC.exe to configure the Recovery control from Windows PE after the Windows 7 reference image has been applied onto the hard drive. For example:

    X:\Windows\system32\reagentc.exe /setosimage /customtool /target C:\Windows
    

To configure a Windows Setup recovery solution

You can provide a recovery image compatible with Windows Setup. When the user initiates the image-recovery operation, a Windows Setup answer file is created automatically to automate the reinstallation process. The answer file contains sufficient information such that users do not have to interact with Windows Setup.

  1. Create a recovery image compatible with Windows Setup. For example, you can use the same reference Windows 7 image you create for deployment.

  2. When deploying Windows to the destination computer, copy the recovery image to the recovery partition after the reference Windows 7 image has been applied onto the hard drive. For example:

    net use n: \\server\share
    Copy N:\Images\install.wim R:
    
    Note:

    Make sure the recovery image is set to the same Windows edition as the deployed Windows 7 image using the DISM tool.

  3. From Windows PE, use REAgentC.exe to associate the recovery image with the Windows 7 installation. For example:

    X:\Windows\system32\reagentc.exe /setosimage /path R:\ /target C:\Windows
    
Note:

If you are using Windows PE 2.X to configure recovery on an offline Windows 7 image, use Winrecfg.exe from the Recovery folder of the Windows OEM Preinstallation Kit (Windows OPK). Winrecfg.exe supports only the offline operations that REAgentC.exe supports, and is not available in the Windows Automated Installation Kit (Windows AIK).

See Also

Configure Windows Recovery Environment