Deploying Windows with a Customized Windows RE
Windows RE is included with Windows 7. When you deploy a Windows computer, you can set up a recovery image. To do this, you must partition the hard disk with a recovery partition, copy the recovery image to this partition, and then create an association between the recovery image and the Windows 7 installation.
A Windows RE image can be installed on GUID partition table (GPT) disks that have the PARTITION_MSFT_RECOVERY_GUID attribute and on master boot record (MBR) disks with the type 0x7 or 0x27. With 0x27 disks, the recovery partition must be at the beginning of the disk. The partition used by Windows RE must be a primary partition formatted as NTFS on the same disk as the partition containing the Windows installation.
The recovery partition can be the same as the system partition, but it is better to separate the partitions. You should size the recovery partition so that it is appropriate for the size of the recovery image. Check the size of your modified Windows 7 installation image to help you size the partition. With a full recovery image, you normally need a recovery partition of between 9 and 10 gigabytes (GB). To set up a computer with MBR hard disks for a recovery partition, follow these steps:
- Start the computer using bootable Windows PE media. The Windows PE into which you boot must include the WinPE-SRT package. Normally, this package is available only in the Windows OPK.
- At the Windows PE command prompt, enter diskpart, and then enter list disk. Note the disks that are available and their sizes. Disk 0 will need enough space for the recovery partition and the partition on which you will install Windows.
- Enter select disk 0, and then enter clean to wipe the disk and remove all contents.
- Create the system partition by entering create partition primary size=size, where size is the size in megabytes of the system partition, such as size=250.
- Format the system partition by entering format=fat32 label="System" quick. Make the system partition the active partition by entering active, and then assign drive letter S by entering assign letter=s.
- Create the recovery partition by entering create partition primary size=size id=27, where size is the size in megabytes of the recovery partition, such as size=1000, and the value id=27 creates a hidden recovery partition.
- Enter format=ntfs label="recovery" quick to format the recovery partition with the NTFS file system.
- Enter assign letter=r to assign the drive letter R for the recovery partition.
- Create the Windows installation partition by entering create partition primary size=size, where size is the size in megabytes of the Windows installation partition, such as size=2000.
- Format the Windows partition by entering format=ntfs label="Windows" quick, and then enter assign letter=c to assign the drive letter C for the Windows partition.
- Enter exit to quit DiskPart. Don't exit the command prompt.
To set up a computer with GPT hard disks for a recovery partition, follow these steps:
- Start the computer using bootable Windows PE media. The Windows PE into which you boot must include the WinPE-SRT package. Normally, this package is available only in the Windows OPK. For Unified Extensible Firmware Interface (UEFI)-based computers, you must start Windows PE by using the EFI boot-mode option in the EFI shell.
- At the prompt, enter diskpart, and then enter list disk. Note the disks that are available and their sizes. Disk 0 will need enough space for the recovery partition and the partition on which you will install Windows.
- Enter select disk 0, and then enter clean to wipe the disk and remove all contents. For UEFI-based computers, you will need to set the GPT disk information by entering convert gpt.
- Create the EFI system partition by entering create partition efi size=size, where size is the size in megabytes of the EFI system partition, such as size=200.
- Format the EFI system partition by entering format=fat32 label="System" quick, and then assign drive letter S by entering assign letter=s.
- Create the MSR partition by entering create partition msr size=size, where size is the size in megabytes of the MSR partition, such as size=128.
- Create the recovery partition by entering create partition primary size=size, where size is the size in megabytes of the recovery partition, such as size=1000.
- Identify the partition as a recovery partition by entering set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac".
- Format the recovery partition by entering format=ntfs label="recovery" quick, and then assign drive letter R by entering assign letter=r.
- Create the Windows installation partition by entering create partition primary. Because you don't specify a size, the partition will fill the remainder of the disk.
- Enter format=ntfs label="Windows" quick to format the partition with the NTFS file system.
- Enter assign letter=c to assign the drive letter C for the Windows partition.
- Enter exit to quit DiskPart. Don't exit the command prompt.
Now that you've configured the computer's hard disks, you can deploy Windows. One way to do this is to complete the following steps:
- Insert the media or connect to the network location containing the Windows 7 image you are deploying.
- Use ImageX to apply the Windows 7 image. For example, if the installation image is on the E drive, you would enter imagex /apply e:\images\install.wim 1 c:.
- You can use BCDBoot to copy system files to the system partition and update the BCD store. To do this, enter cd c:\windows\system32, and then enter bcdboot c:\windows /l en-us /s s:. The /l option sets the locale. The /s option specifies the drive designator for the system partition.
- Copy the Windows RE image to partition 1. For example, if the installation image is on the E drive, you would enter copy e:\images\winre.wim r:.
- Create an association between the Windows RE image and the Windows 7 installation using Reagentc.exe. For example, enter reagentc.exe /setreimage /path r:\.
Tip Optionally, you can map a keyboard key or a custom hardware button to launch Windows re directly when the key or button is pressed during startup of the system. to map the key or button, add the /Bootkey option when using reagentc.exe to associate the Windows re image to the Windows 7 installation. For example, enter reagentc.exe /setreimage /path r: /bootkey ScanCode, where ScanCode is the four-digit hexadecimal scan code of the keyboard key or custom hardware button.
Note Normally, the Windows re installation will be complete when the user finalizes the installation. however, if you need to start the computer in audit mode before completing the installation and you are not generalizing the installation again by using the Sysprep tool, you can complete the Windows re installation during audit mode. at the command prompt, enter reagentc.exe /enable /auditmode.
Another way to deploy Windows is to use separate images for each partition. Let's say you capture separate images using the following steps:
- Start the computer using bootable Windows PE media. For UEFI-based computers, you must start Windows PE by using the EFI boot-mode option in the EFI shell.
- At the Windows PE command prompt, enter diskpart, then enter select disk 0, and then enter list volume. Note the partition information provided. If any partition you want to capture doesn't have a drive letter, you need to select the volume and then assign a drive letter. For example, if the recovery partition is volume 0 and it doesn't have a drive letter, enter select volume 0, and then enter assign letter=r.
- Enter cd c:\windows\system32 to change to the directory containing the ImageX tool.
- Capture images for each customized partition. If you have separate Windows,
system, and recovery partitions, you could use the following commands:
imagex /capture c:\ c:\win-partition.wim "Windows partition"
imagex /capture s:\ c:\sys-partition.wim "System partition"
imagex /capture r:\ c:\rec-partition.wim "Recovery partition" - Connect to your distribution share by using the Net Use command, such as
net use Z: \\ImageShare\Images. Copy the WIM files to the network share by using the following commands:
copy c:\win-partition.wim Z:\
copy c:\sys-partition.wim Z:\
copy c:\rec-partition.wim Z:\
Now you can apply the separate images using the following steps:
- Start the computer using bootable Windows PE media. For UEFI-based computers, you must start Windows PE by using the EFI boot-mode option in the EFI shell.
- Insert media or connect to the network location containing images you are deploying. You can connect to a network location with Net Use-for example, net use Z: \\ImageShare\Images.
- At the Windows PE command prompt, enter diskpart, enter select disk 0, and then enter list volume. Note the partition information provided. If any partition you want to apply an image to doesn't have a drive letter, you need to select the volume and then assign a drive letter. For example, if the recovery partition is volume 0 and it doesn't have a drive letter, enter select volume 0, and then enter assign letter=r.
- Enter cd c:\windows\system32 to change to the directory containing the ImageX tool.
- Use ImageX to apply the Windows partition image. For example, if the installation image is on the Z drive, you would enter imagex /apply z:\winpartition.wim 1 c:.
- Use ImageX to apply the system partition image. For example, if the system partition image is on the Z drive, you would enter imagex /apply z:\syspartition.wim 1 s:.
- Use ImageX to apply the recovery partition image. For example, if the recovery partition image is on the Z drive, you would enter imagex /apply z:\rec-partition.wim 1 r:.
In this tutorial:
- Deploying Windows 7
- Working with Windows PE
- Understanding Windows pe
- Configuring Windows PE
- Preparing a Build environment
- Creating a Build: the essentials
- Mounting a Windows pe Image
- Customizing a Windows PE Image
- Capturing and Optimizing a Build
- Creating a Bootable ISO Image and Bootable Media
- Creating a Bootable USB Flash Drive
- Booting to an Image from a hard Disk
- Adding Windows pe Images to Windows Deployment Services
- Working with Windows RE
- Creating a Customized Windows RE Image
- Creating Windows re recovery Media
- Adding Windows RE Images to Windows Deployment Services
- Deploying Windows with a Customized Windows RE
- Creating Windows Images for Deployment
- Understanding Windows Imaging
- Creating a Windows Install Image
- Configuring and Using Windows Deployment Services
- Setting Up Windows Deployment Services
- Importing Images
- Installing Windows from an Image
- Capturing Images
- Managing access and prestaging Computers
- Modifying Image File Security
- Customizing Windows Images