Windows 7: Deploying Windows 7

Using deployment images is the best way to roll out Windows 7, whether to dozens or thousands of desktops.

Brien M. Posey

The process for deploying Windows 7 should be relatively similar, whether you work in a small office with just a few employees or a large enterprise with hundreds or thousands of desktops. You’ll most likely base your new Windows 7 deployments of any scale on deployment images. This is the most efficient way, but it does require some work in advance.

You’ll need to create an initial deployment image you can use to set up Windows on your corporate desktops. Although there’s a bit of work involved in creating a deployment image, doing so saves work in the long run because you don’t have to worry about configuring each system individually. Using images for deploying Windows 7 also ensures that each system is set up in a uniform manner.

There are many different techniques for creating and managing Windows deployment images. The Windows Automated Installation Kit (AIK), which you can download from the Microsoft download center, is one of the more straightforward techniques. You’ll also need a Windows 7 installation DVD. While it’s impossible to address every configuration option here, we’ll examine the techniques for building and capturing an initial deployment image.

Create an Initial Image

The first step in creating a customized Windows 7 deployment image is to create a base image. From this image, you can tailor it to suit your organization’s needs. Begin the process by installing the Windows AIK and launching the Windows System Image Manager (which is located on the Start menu under All Programs | Microsoft Windows AIK | Windows System Image Manager).

Next, insert your Windows 7 installation DVD into the system. Right-click on “Select a Windows Image,” or “Catalog File” within the Windows System Image Manager and choose the “Select Windows Image” command from the shortcut menu. The system will prompt you to select a Windows Image. Use the browse window to navigate to the Windows 7 installation DVD Sources folder and select the INSTALL.WIM file.

Depending on where you got your Windows 7 installation DVD, you might see a prompt asking you which version of Windows you want to manage. Select the appropriate version and click OK.

Create an Answer File

The next step in the deployment project is to create an answer file. You’ll use this for unattended installations. Start by creating an empty XML file, and then populate that answer file with the required information. Create the empty answer file by choosing the “New Answer File” command from the Windows System Image Manager File menu.

Next, choose the “Safe Answer File” command from the file menu. Windows will try to place the answer file onto your installation DVD. Because that’s not really an option, you should create a separate directory and store the answer file there. Create a folder named Answer and call the answer file UNATTENDED.XML. When you do, the Windows System Image Manager should display both the Windows image and the answer file (see Figure 1).

The console should display the image and the answer file

Figure 1 The console should display the image and the answer file.

You’ll notice in Figure 1 that the Answer File portion of the console displays a Components container. This stores seven different sub-containers. When you build a Windows deployment image, the Windows System Image Manager has to add the Windows components to the image in a specific sequence. The seven Components containers correspond to the seven stages of the sequencing process.

You’ll also notice the Windows Image section includes a container called Components. If you expand this container, you’ll see a list of the various Windows components. Add the Windows components you want to use to the appropriate sequencing containers within the Answer File section. You can do this by right-clicking on a component and choosing the Add Settings to Pass command from the shortcut menu.

This process can be a bit tricky, but Windows helps you in that each component is only valid for use within certain containers. The console only lets you place a component within a valid container (see Figure 2).

Add the Windows components to the appropriate containers

Figure 2 Add the Windows components to the appropriate containers.

Every organization’s needs are different in terms of which components you’ll need to add. Even different environments within the same organization may have different needs. As you begin to add components, the console will take shape (see Figure 3). As you select a component, the console displays the properties and the settings for that component. Any settings you configure during this stage of the process will be added to your answer file. When you’re done, be sure to save your answer file before closing the console.

Many components include configurable settings

Figure 3 Many components include configurable settings.

Building a Windows PE Boot Disk

You’ll eventually use the answer file you’ve just created to prepare a Sysprep Windows image. The problem with doing that, however, is that once you Sysprep a PC, you’ll need a way to copy the image off the PC from outside the main OS. The easiest way to do this is to build a Windows PE boot disk.

To create a Windows PE boot disk, open an elevated Command Prompt window and enter the following commands:

C:
CD\PROGRAM FILES\WINDOWS AIK\TOOLS\PETOOLS
COPYPE AMD64 C:\WINPE
IMAGEX /MOUNTRW C:\WINPE\WINPE.WIM 1 C:\WINPE\MOUNT
CD\WINPE\MOUNT\WINDOWS\SYSTEM32
COPY CON WIMSCRIPT.INI

This command sequence creates a file in the C:\winpe\mount\windows\system32 folder called WIMSCRIPT.ini. Then, you must enter the commands here (when you’re done, press the F6 key followed by Enter to create the file):

[ExclusionList]
pagefile.sys
ntfs.log
hiberfil.sys
"System Volume Information"
RECYCLER
Windows\CSC
[CompressionExclusionList]
*.mp3
*.zip
*.cab
\WINDOWS\inf\*.pnf

Once you’ve created the WIMSCRIPT.INI file, run the following commands:

IMAGEX.EXE /UNMOUNT /COMMIT C:\WINPE\MOUNT
CD\WINPE
COPY WINPE.WIM C:\WINPE\ISO\SOURCES\BOOT.WIM /Y
OSCDIMG –N –H –BC:\WINPE\ETFSBOOT.COM C:\WINPE\ISO C:\WINPE\WINPE.ISO

These commands will write a file called WINPE.ISO to the C:\WINPE folder. Burn this file to a DVD. This is your Windows PE boot disk.

Creating the SYSPREP Image

Now that you’ve created both an answer file and a Windows PE boot disk, it’s time to create the actual deployment image. Install Windows 7 onto a spare PC. When you get to the point during installation when you’re asked to provide your name and a name for the computer, press Crtl+Shift+F3 instead of entering the requested information. This will force Windows to reboot into audit mode.

When the system boots, you’ll see a Sysprep dialog box (see Figure 4). Close the dialog box and begin making any required configuration changes to the system. You can also install any applications and drivers you want. It’s OK if any of the applications you’re installing require a reboot, because the system will boot back into audit mode.

Ignore the Sysprep dialog box upon reboot

Figure 4 Ignore the Sysprep dialog box upon reboot.

When you’ve finished configuring this PC, it’s time to bring in the answer file that you created earlier. Copy the answer file to the C:\Windows\System32\sysprep folder.

Keep in mind that the answer file you created probably contains sensitive information. You don’t want this information copied to other desktops set up with this deployment image you’re creating, so you need to create a script to get rid of the answer file when it’s no longer needed (don’t forget to make a copy of the answer file for yourself first).

To do this, create a folder named C:\Windows\Setup\Scripts. Create a text file within that folder named SetupComplete.cmd. Add two commands to this file:

Delete /Q /F C:\Windows\system32\sysprep\unattended.xml
Delete /Q /F C:\Windows\panther\unattended.xml

When you’re done configuring the system and creating the script to get rid of the answer file, you’re ready to run Sysprep. Open an elevated Command Prompt window and enter the following command:

SYSPREP /GENERALIZE /OOBE /SHUTDOWN /UNATTEND:UNATTEND.XML

When you run this command, Sysprep will generalize the system to deploy your configuration to other systems. When it finishes, the system will shut down. Don’t turn the computer back on until you read the next section.

Capture the Image

Now that you’ve Sysprepped the system, you must capture the computer’s current state. Because booting the computer into Windows will ruin the generalization you’ve just performed, you need to boot the system using the Windows PE boot disk you created earlier.

When the system boots into the Windows PE environment, run the following commands:

C:\
MD Images
CD\windows\system32
Imagex /capture h: c:\images\captured.wim “Windows 7 x64”

This process will create a file named C:\images\captured.wim. You can use this file to install Windows. Simply copy it to the machine from which you will run your Windows deployments.

Now that you’ve created your image, you may need to add drivers, add or remove Windows features, or perform any other management tasks. You can do this with a tool included in the Windows AIK called the Deployment Imaging Service and Management Tool. Access this tool by opening an elevated Command Prompt window and navigating to the C:\Program Files\Windows AIK\Tools\AMD64\Servicing folder.

Mounting a WIM

Before you can make any modifications to your deployment image, you’ll need to copy it to the PC upon which you installed the Windows AIK. For the purpose of this article, assume that the .wim file is located in a folder named C:\Images.

Before using the .wim image, you’ll have to mount it. Enter the following command at an elevated Command Prompt:

DISM /Mount-Wim /WimFile:<path to your WIM file> /index:1 /MountDir:C:\demo

Figure 5 shows an example of a Windows image file.

You can use DISM to mount .wim or .vhd files

Figure 5 You can use DISM to mount .wim or .vhd files.

List the Packages and Features

Once you’ve mounted the Windows image file, there are several things that you can do. You might want to see which packages it’s installing as part of the image. You can do so with the following command (see Figure 6):

DISM /image:C:\demo /Get-Packages

se the DISM command to view the packages included in an installation image

Figure 6 Use the DISM command to view the packages included in an installation image.

You could also use the DISM command to view the device drivers or the Windows features included within the package. To do so, you would use these two commands:

DISM /image:C:\demo /Get-Drivers
DISM /image:C:\demo /Get-Features

These are just a few examples of how you can use the DISM command. For more detailed examples, Microsoft provides the full command syntax.

Using images to deploy Windows 7 does indeed require some advance work, but it will streamline the process for later deployments.

Brien M. Posey

Brien M. Posey, MVP, is a freelance technical author with thousands of articles and dozens of books to his credit. You can visit Posey’s Web site at brienposey.com.