Creating a Windows Install Image
The primary tool you use to prepare Windows install images is Sysprep. Before you use Sysprep on any computer, keep in mind that Sysprep removes unique identifiers from the computer you are preparing and designates it as a master deployment computer. At the end of this process, the computer no longer has identifying information that allows it to be logged on to and used within a domain or workgroup. After you create your install image, you can reinstall Windows and then start using the source computer again.
On all editions of Windows 7, Sysprep is stored in the %SystemRoot%\System32\ Sysprep folder. Table 2-3 provides an overview of key options for Sysprep. Note all editions of Windows 7 must be activated within a specified period of time, even if you are using volume activation with Key Management Service (KMS) servers. When you use the /Generalize option for the first time, Sysprep sets the initial Windows activation grace period, providing 30 days to activate the system once it is deployed. When a system exceeds its grace period, you can run Sysprep /Generalize again to reset the activation grace period, providing an additional 30 days to activate the system. You can do this up to three times. however, generalizing a system removes all unique identifiers, clears system restore points, and removes the event logs.
Tip When you are using Key Management Service (KMS), you can return a computer to its initial activation state by using the Slmgr.vbs script with the -rearm option. this option resets the activation period and reinitializes some activation parameters, including the computer's unique machine ID. the number of times you can reset the activation period in this way depends on how many times you've reset the activation period previously using Sysprep /Generalize. the maximum number of times you can reset the activation period is three.
Key Options for Sysprep
OPTION | DESCRIPTION |
/Audit | Sets the computer to start in audit mode. In audit mode, you can add drivers and applications to the operating system. You also can use audit mode to test the installation before deploying it. |
/Generalize | Prepares the Windows installation to be imaged by removing all unique system identifiers. The computer's security identifier (SID) is reset, system restore points are cleared, and event logs are removed. The next time the computer starts, a new SID is created. |
/Oobe | Sets the computer to start in welcome mode, which is the mode in which users will receive the deployed computer. |
/Reboot | Restarts the computer. |
/Shutdown | Turns off and shuts down the computer after Sysprep finishes preparing the computer. |
/Quiet | Runs Sysprep without displaying on-screen confirmation messages. Use this mode if you automate Sysprep. |
/Quit | Closes Sysprep after running the specified command. |
/Unattend:AnswerFile.xml | Applies settings in an answer file during an unattended installation, where AnswerFile.xml is the name of the answer file. |
To prepare a computer, log on to the system you want to configure as a custom image and use as the basis for other computer images. Configure the computer by modifying the settings, installing applications, and making any necessary changes. Once you've configured a computer's components, you can use Sysprep to prepare it for use as an image.
Sysprep has a command-line mode and a graphical user interface mode. Every time you use Sysprep, Sysprep looks for:
- A clean-up action, which is to enter either the System Out-of-Box Experience (OOBE) mode or the System Audit mode on the next restart, and optionally to generalize the system.
- A shutdown option, which is either to quit, to reboot, or to shutdown after running the specified command.
Before you can start and use Sysprep, you must open an elevated administrator command prompt and then enter cd %systemroot%\system32\sysprep.
Using Sysprep, you can generalize a computer and set it to start in OOBE mode on the next reboot by using the settings or by entering:
sysprep /oobe /generalize /quit
If you want to install additional applications and modify the configuration after generalizing the computer, you can set the computer to restart in System Audit mode by entering the following:
sysprep /audit /generalize /reboot
You can then make any necessary changes. These changes will be tracked so that they can be applied when the system is deployed. When you have finished modifying the computer, you can finalize the operating system by setting the computer to shut down and start in OOBE mode on the next reboot by entering the following:
sysprep /oobe /shutdown
The system is then ready for imaging. After you've prepared the system, you can import the image into Windows Deployment Services for later deployment, or you can capture the image and deploy it manually. You'll learn more about Windows Deployment Services later in the tutorial. To capture the image manually, follow these 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 an elevated administrator command prompt, enter diskpart, and then enter list disk. Note the number of the disk you want to use. Enter select disk n, where n is the disk you want to use.
- 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 system partition is volume 1 and it doesn't have a drive letter, enter select volume 1, and then enter assign letter=s.
- 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
and system 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" - 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:\
You can apply the separate images by 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, such as 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 driver 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:\win-partition.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 /applyz:\sys-partition.wim 1 s:.
- Restart the computer and log on.
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