Partager via


Walkthrough: Deploy a Windows RE Image on Hard Drive

This walkthrough describes how to deploy a Windows Recovery Environment (Windows RE) image onto a hard drive. Windows RE is a solution that is based on Windows PE 2.0. In this example, you build a master computer that contains two partitions, one for Windows Vista and one for Windows RE. Once installed, you configure Windows Vista Boot Manager to automatically failover to Windows RE when Windows Vista is unable to boot.

Important

This walkthrough outlines how to build the Windows RE solution, not a complete Windows Vista image. You must still create a separate Windows Vista installation.

This walkthrough illustrates a hidden (type 0x27) Windows RE disk configuration. In the following illustration, the Windows RE partition is located in front of the Windows Vista partition.

Windows RE-only (hidden)

Windows RE

Type 0x27

1 gigabyte (GB)

Windows Vista

Type 0x7

(active)

There are other Windows RE disk configurations that coexist with Bitlocker Drive Encryption. For more information about disk configurations, see Preinstallation Design.

Prerequisites

To complete this walkthrough, you will need the following:

  • A Windows RE image as described in Walkthrough: Create a Windows RE Image.
  • A technician computer that provides all the tools and the source files. For more information, see Building a Technician Computer.
  • An authorized copy of Windows Vista.
  • A USB flash drive (UFD). In this example, the storage size must be 256 megabytes (MB) or bigger, depending on how many additional applications that you include in your Windows RE image.
  • A master computer on which you will deploy Windows Vista and Windows RE.

Step 1: Create an answer file

In this step, you build a catalog file (.clg) and a new blank answer file. A .clg file is a binary file that contains the state of all the settings and the packages in a Windows image.

  1. On your technician computer, insert the Windows Vista product DVD into the local DVD drive.
  2. Navigate to the \Sources directory on the Windows Vista DVD. Copy the Install.wim file to your technician computer.
  3. Click Start, point to Programs, point to Microsoft Windows OPK (or Windows AIK), and then click Windows System Image Manager.
  4. On the File menu, click Select Windows Image.
  5. In the Select a Windows Image dialog box, navigate to the location where you saved the Install.wim file, and then click Open.

Note

A warning will appear that a catalog does not exist. Click OK to create a catalog. A catalog file (.clg) is a local file that contains all the available settings.

  1. On the File menu, click New Answer File.

Step 2: Define Windows RE settings

In this step, you define Windows RE partition requirements in your answer file. In addition, you will set a synchronous command to run a SetAutofailover.cmd script.

  1. In Windows SIM, in the Windows Image pane, expand the Components node to display available settings.

  2. In the expanded list of components, add the following components to your answer file by right-clicking the component and then by selecting the appropriate configuration pass.

Component Configuration Pass

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

1 windowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

1 windowsPE

Microsoft-Windows-Setup\ImageInstall\DataImage\InstallFrom

1 windowsPE

Microsoft-Windows-Setup\ImageInstall\DataImage\InstallTo

1 windowsPE

Note

Expand the component list until you see the lowest setting that is listed above, and then add that setting to your answer file. This shortcut will add the setting and all parent settings to your answer file in one step.

  1. All the settings that you added must appear in the Answer File window. Select and configure each setting as specified below.
Component Value

Microsoft-Windows-Setup\DiskConfiguration

WillShowUI = OnError

Microsoft-Windows-Setup\DiskConfiguration\Disk

DiskID = 0
    WillWipeDisk = true

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

Extend = false
    Order = 1
    Size = 1500
Note
You can adjust size accordingly; this example uses 1.5 gigabytes (GB).
Type = Primary

Microsoft-Windows-Setup \DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

Active = false
    Extend = false
    Format = NTFS
    Label = WinRE
    Order = 1
    PartitionID = 1

Microsoft-Windows-Setup\ImageInstall\DataImage

Order = 1

Microsoft-Windows-Setup\ImageInstall\DataImage\InstallFrom

Path = <location of your custom Windows RE image>

For example, C:\winre_x86\winre.wim

Microsoft-Windows-Setup\ImageInstall\DataImage\InstallTo

DiskID = 0
    PartitionID = 1

Note

The Credentials settings are not required for this walkthrough. You must delete the Credentials entry from your answer file to validate your answer file.

</div></td>
</tr>
</tbody>
  1. Validate the answer file, click Tools, and then click Validate Answer File.
    If an error occurs, correct the error and revalidate the answer file.

  2. Save the answer file.

Step 3: Define Windows settings

By using the same answer file from Step 2, you define Windows Vista settings. The settings in this example will configure a single partition, will set the locale, and will boot the computer into Audit mode.

  1. In Windows SIM, in the Windows Image pane, expand the Components node to display available settings.

  2. In the expanded list of components, add the following components to your answer file.

Component Configuration Pass

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\ CreatePartition

1 windowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ ModifyPartition

1 windowsPE

Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo

1 windowsPE

Microsoft-Windows-Setup\UserData

1 windowsPE

Microsoft-Windows-Shell-Setup \OEMInformation

4 specialize

Microsoft-Windows-Shell-Setup \AutoLogon

7 auditSystem

Microsoft-Windows-Shell-Setup\OOBE

7 oobeSystem

Microsoft-Windows-International-Core-WinPE\SetupUILanguage

1 windowsPE

Microsoft-Windows-Deployment\Reseal

7 oobeSystem

Microsoft-Windows-PnpSysprep

3 generalize

  1. All the settings that you added must appear in the Answer File pane. Select and configure each setting as specified below.
Component Value

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

Extend = false
    Order = 2
    Size = 15000
Note
You can adjust the Size accordingly; this example uses 15 GB.
Type = Primary

Microsoft-Windows-Setup \DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

Active = true
    Extend = false
    Format = NTFS
    Label = OS_Install
    Letter = C
    Order = 2
    PartitionID = 2

Microsoft-Windows-Setup\ImageInstall\OSImage\

WillShowUI = OnError

Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo

DiskID = 0
    PartitionID = 2

Microsoft-Windows-Setup \UserData

AcceptEula = true

Microsoft-Windows-Setup \UserData\ProductKey

Key = <product key>
    WillShowUI = OnError

Microsoft-Windows-Shell-Setup \OEMInformation

HelpCustomized = false
    Manufacturer = <company name>
    SupportHours = <support hours>
    SupportPhone = <support number>
    SupportURL = <support URL>

Microsoft-Windows-Shell-Setup \AutoLogon

Enabled = true
    LogonCount = 5
    Username = Administrator

Microsoft-Windows-Shell-Setup \OOBE

ProtectYourPC = 3
    NetworkLocation = Work

Microsoft-Windows-International-Core-WinPE

InputLocale = <Input Locale>
    SystemLocale = <System Locale>
    UILanguage = <UI Language>
    UserLocale = <User Locale>

Microsoft-Windows-International-Core-WinPE\SetupUILanguage

UILanguage = <UI Language>

Microsoft-Windows-Deployment\Reseal

ForceShutdown = true
    Mode = Audit

Microsoft-Windows-PnpSysprep

PersistAllDeviceInstalls = True
These settings outline a basic unattended installation; no user input is required during Windows Setup. When the installation is complete, the computer will reboot to Audit mode. Windows Welcome does not run in Audit mode. For more information about Audit mode, see [Customize Windows in Audit Mode](cc722413\(v=ws.10\).md). In Audit mode, you can perform additional customizations and configurations. When complete, OEMs and system builders must run **sysprep /oobe** to enable Windows Welcome the next time the computer restarts. Windows Welcome prompts the end user to read the Microsoft Software License Terms and to configure the computer.
  1. Validate your answer. To do this, click Tools, and then click Validate Answer File.
    If an error occurs, correct the error and revalidate.

  2. Save your answer file.

Step 4: Create a configuration set

In this step, you create a configuration set. The benefit of this method is that all the files that are necessary for the installation are contained in one location. In this example, you save the configuration set to a USB flash drive (UFD).

  1. In Windows SIM, on the Tools menu, select Create Configuration Set.
    The Create Configuration Set window opens.
  2. Specify a destination location where you intend to publish the configuration set (for example, directly to your UFD), and then click OK.

Important

This feature creates an answer file (Autounattend.xml) and a resource folder (\AutoUnattend_Files). In this example, both the file and the folder must be located at the root of your UFD.

Step 5: Add partition repair script

In this step, you create a partition repair script called WinREPartitionInfo.xml. The script helps repair hidden and customized partitions if disk corruption occurs.

  1. Create an .xml file called WinREPartitionInfo.xml with the following content.

    <WinREPartitionInfo>
         <NotActive/>
         <WinREHiddenPartition/>
    </WinREPartitionInfo>
    

    <NotActive> instructs Windows RE not to set the first partition to active in the event you have multiple boot partitions. <WinREHiddenPartition> instructs Windows RE to set the Windows RE partition as type 0x27 with no drive letter assigned. This method does not support other hidden partition types.

  2. By using your removable media, place a copy of the file at the root of each hidden or customized partition.

Step 6: Copy script to USB flash drive

In this step, you include the provided Setautofailover.cmd script, which configures Windows Vista to start Windows RE during a failover. You copy the script to your UFD.

  • Copy Setautofailover.cmd to the root of your UFD. For example,

    copy c:\Program Files\<version>\recovery\setautofailover.cmd e:
    

    where <version> can be Windows OPK or Windows AIK and e is the letter of the root of your UFD.

Step 7: Build your master installation

In this step, you build your master installation by using a Windows Vista product DVD and your configuration set. After setup completes, you manually run the Setautofailover.cmd script.

  1. Turn on the master computer.

  2. Insert both the removable media containing your configuration set and the Windows Vista product DVD into the new computer.

  3. Restart the computer (CTRL+ALT+DEL).
    Windows Setup (Setup.exe) begins automatically. By default, Windows Setup searches all removable media for an answer file called Autounattend.xml.

  4. After Setup completes, the computer starts in Audit mode. Verify that all your customizations were applied.

  5. At a command prompt, run Setautofailover.cmd with the following parameters.

    e:\Windows\setautofailover.cmd /target d: /mainos {default} /disk 0 /partition 1
    

    where e is the letter of the root of your UFD device. When you are finished, reseal and shut down the computer. In the System Preparation Tool dialog box, select the appropriate options.
    For Extensible Firmware Interface (EFI) systems, you must configure use for GUID Partition Table (GPT) disk. To configure for GPT, add the /gpt option. Here is an example of this command.

    e:\Windows\setautofailover.cmd /target d: /mainos {default} /disk 0 /partition 1 /gpt
    

Important

If you select the sysprep generalize option, the failover settings will be removed. To generalize the image for build-to-plan (BTO) environments, run Setautofailover.cmd during the oobeSystem pass. For example, copy the script to the root of the hard drive and specify a RunsynchronousCommand during oobeSystem pass in your answer file. To do this, select Insert, then Synchronous Command, and then Pass 7 oobesystem.

Alternate Configuration: Windows RE as a .wim File

Windows RE can also be installed directly as a .wim file instead of an expanded image on the hard disk partition. When you use this configuration:

  • The Windows RE .wim image file must be named Winre.wim.

  • The Windows RE .wim image file must be located at the root directory of the target partition.

  • When defining the Windows RE settings in the answer file, the following components should be used.

Component Configuration Pass

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

1 windowsPE

Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

1 windowsPE

Microsoft-Windows-Setup\RunSynchronous\RunsynchronousCommand

1 windowsPE

  • The settings should be configured as follows:
Component Value

Microsoft-Windows-Setup\DiskConfiguration

WillShowUI = OnError

Microsoft-Windows-Setup\DiskConfiguration\Disk

DiskID = 0
    WillWipeDisk = true

Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition

Extend = false
    Order = 1
    Size = 1500
Note
You can adjust Size accordingly. This example uses 1.5 GB.
Type = Primary

Microsoft-Windows-Setup \DiskConfiguration\Disk\ModifyPartitions\ModifyPartition

Active = false
    Extend = false
    Format = NTFS
    Label = WinRE
    Order = 1
    PartitionID = 1

Microsoft-Windows-Setup\RunSynchronous\RunsynchronousCommand

(windowsPE Configuration Pass)

Copies Windows RE image file.

Order = 1
    Path = "d:CopyWinRE.cmd"

Note

You must create the CopyWinRE.cmd script to copy both your Windows RE image and the boot.sdi file to the destination partition. Boot.sdi can be found in your Windows PE build environment under the \ISO\Boot directory (for example, C:\Winre_x86\ISO\Boot).

</div></td>
</tr>
</tbody>

To set the automatic failover mechanism by using the /wim option, run the following command:

setautofailover.cmd /wim /target d: /mainos {default} /disk 0 /partition 1

The /wim option in Setautofailover.cmd configures the computer to use Winre.wim from the root directory of the destination partition as the Windows RE image.

For Extensible Firmware Interface (EFI) systems, you must configure use for GUID Partition Table (GPT) disk. To configure for GPT, add the /gpt option. For example,

setautofailover.cmd /wim /target d: /mainos {default} /disk 0 /partition 1 /gpt

Next Step

You can also create Windows RE media. For more information, see Walkthrough: Create a Windows RE Recovery Media.

See Also

Concepts

Customization Walkthroughs