WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button

PC Deployment with ImageX

by Jim Aspinwall
04/03/2007

ImageX, a component within the Windows Automated Installation Kit, is a welcome tool in Microsoft's new system deployment and management arsenal. ImageX provides a new approach to capturing, configuring, editing, and deploying the contents of entire disks, as a replica of an entire file system within a file. Instead of scraping data sector by sector from a hard drive to a file or series of files, ImageX copies the file system as a set of files and directories, which has significant advantages for inspecting and modifying images before their deployment.

The portability and manageability of virtual PC and virtualized application technology has been applied to distributing entire file systems as ImageX's Windows Image (WIM) files. WIM files represent an entire disk drive file system that can be accessed, viewed, modified, and saved at will, as if working with a large document. This article and its counterpart, PC Deployment with WinPE, will show you how to get quick and effective results capturing and deploying Windows Vista, as well as Windows XP and 2003.

ImageX spares us the time-wasting doldrums of conventional imaging. We are familiar with software that collects and stores the occupied tracks and sectors of a hard drive as binary fragments replicating the source drive, then deposits these fragments onto other hard drives. However, in the past this method has left us unable to reconfigure our images without working in a vicious cycle of running the full operating system, reconfiguring, running SYSPREP to cleanse the OS of machine-dependent artifacts, and then recapturing and reapplying the image. You can use ImageX to perform similar operations more efficiently.

ImageX is certainly not an elegant tool (there is no GUI or wizard to guide you through its use); it is a simple command-line utility. The primary function of ImageX is to capture or lay down file systems between hard drives.

ImageX also provides the ability to mount and provide access to the contents of a file system so it can be configured, modified, have application packages added to it, and be saved for subsequent deployment.

Prerequisites

Microsoft's ImageX tools are available only in the free Windows Automated Installation Kit (WAIK). The full features of WAIK, which include image, application packaging, and deployment management, are available when WAIK is installed on a Windows 2003 Server. If WAIK and Windows Deployment Services (WDS) are installed on a server running Microsoft's Remote Installation Services (RIS), it can also support deployments of legacy operating systems, now redefined to include Windows XP as well as earlier operating systems.

Installing WAIK on a Vista client gives you access to only the Windows Pre-Installation Environment (WinPE) and Windows System Image Manager. Business Desktop Deployment (BDD) and WAIK with WDS on Windows 2003 Server will become your friends as you begin to test boot scenarios and simplify or totally automate OS deployments.

Once you have WAIK installed on a Vista or 2003 system, the x86, x64, and AMD64 versions of ImageX are available to copy to bootable WinPE media to capture and deploy images on any platform. To create a bootable WinPE USB flash drive, follow the instructions in "PC Deployment with WinPE" (though you can work as easily via a PXE-booted WinPE, which gives you RIS and WDS image deployment options).

Pros and Cons of ImageX

It seems that every tool we use to manage our environment has some "gotchas" to go along with the benefits. ImageX is no exception. ImageX can be run automatically through a configuration file, saving a lot of time and ambiguity when performing mass deployments. It will support legacy OS images such as XP, as well as Vista and 2003--either 32- or 64-bit--and image files can be split into fragments to fit onto various media. You can modify the content of a Vista installation WIM file by mounting its file and directory system on a hosting XP, 2003, or Vista PC.

Unfortunately you cannot edit XP, 2003, or previous OS images, no matter which OS you are hosting WinPE and ImageX on. Image modification allows you to change the configuration and contents of the image and add software packages, but you cannot install or remove applications without actually running the OS on a target PC, installing the application as usual, then recapturing the image (just as we've done in the past).

The familiar SYSPREP process is still required to clear hardware dependencies and the SID for Vista. The multiple configuration files of sysprep and other first-boot process are combined within a single XML configuration file.

The Basics

ImageX is typically run under WinPE, which provides full Windows networking features to store or get image files from a network share, and provides access to disk drives on the host PC on which WinPE is run. ImageX provides four essential functions:

  • Capture
  • Mount and MountRW
  • Unmount and Commit
  • Apply

Capture and Apply equate to the "Create image" and "Restore image" functions you may be familiar with from using Symantec Ghost or something similar. Capture of course copies and stores the file system from a disk drive in WIM format, and Apply copies the contents of a WIM file onto a target disk drive.

Capture

To capture the image of a C: drive to a specific WIM file written to drive C: or another target drive, the simplest command-line for ImageX would be similar to:

imagex /capture c: c:\c_drive.wim "My_C_Drive"

In this example, the data is placed into the WIM file with a minimal amount of compression, the WIM file description (a required value) is "My_C_Drive," and the process does not verify the WIM file contents. Additional switches of interest offer maximum, fast (less), and no compression, and verification of the resulting file. If the WIM file is a customized Vista INSTALL.WIM to be used by Windows setup, you need to add the /flags switch and declare the name of the Vista edition.

ImageX captures can be preconfigured using a /config switch, followed by the name of a configuration INI file to exclude specific files from being compressed when captured, and to exclude files from capture into the WIM file.

ImageX stores your disk image in one large file. If you need to store your WIM file on multiple disks, you can run ImageX with a /split switch to break up the file into segments of a size you specify.

Mount and MountRW

The /mount switch mounts a WIM file into a folder on the host PC's hard drive as a complete but read-only replica of the file system from the disk captured to the WIM file. The /mountrw switch mounts the file system in an editable mode.

WIM files can only be mounted under Windows Vista or 2003. To work with an image under WinPE, it must be applied to a hard drive rather than a mount point. When you're done working with the WIM file, you can then unmount the file system and it will "evaporate" untouched, wiping out any edits you have made. Unmount the file system with the /commit switch and any changes you have made will be stored in the WIM file.

A command-line example of mounting a WIM file for reconfiguration can be as simple as:

    imagex /mountrw c:\c_drive.wim 1 c:\mounted_images

In this example, (logical) volume/drive 1 of WIM file c_drive.wim is mounted with read-write access to its files, which will appear in the c:\mounted_images folder. To mount and access your WIM file, your PC needs the WIM file system "filter" driver: wimfltr.sys. The wimfltr.sys driver is installed when WAIK is installed, but for systems and media to which you copy ImageX, place the wimfltr.* files on the host system, then locate them, right-click, and select Install for the appropriate wimfltr.inf for your X86, IA64, or AMD64 host operating system.

Apply

Of course the purpose of imaging is to be able to deploy the image to other computers, which brings us to the /apply function. Quite simply:

imagex /apply d:\images\c_drive.wim 1 c:\

This command-line example copies volume/image 1 of the c_drive.wim image to the C: drive of the hosting PC. You can add the /verify switch at the end to check the results in the process.

Additional Features

Beyond the basics, ImageX has some nifty features that were cumbersome or impossible with previous imaging tools. For instance, not only can you easily add or modify an image, you can combine multiple images into one WIM file for more controlled and complete distribution using ImageX's append function. ImageX also allows for multiple means of distribution by letting you break up a WIM file into separate segments using the split function.

Append

Append is a standalone function of ImageX that will add the contents of a disk volume to an existing WIM file. Let's say you've created an image of a C: drive containing an operating system, preinstalled applications, and desired configuration. You add a D: drive containing a variety of data files and perhaps some additional application packages. Using ImageX with the /append option lets you add the contents of the D: drive to the WIM file of the C: drive--combining two volumes into one ImageX file. A sample command-line to append images using ImageX would be:


    imagex /append d: c:\data_drive.wim

From the appended WIM file you can then apply either volume 1 (the first drive in the appended image) or volume 2 (the second drive in the image) in two simple steps without switching WIM files.

Split

The split feature of ImageX is as follows:

    imagex /split c:\c_drive.wim 650

Once a WIM file is split, it cannot be reassembled, nor can it be mounted and modified. Because of this you should retain a copy of the entire, original single WIM file to work with and perform modifications, then split only a working copy of your completed image--into either or both CDs and DVDs. After the split you will then "burn" each of the fragments to individual media.

When you apply a split image, ImageX will recognize that you have split the image and prompt you for the additional media accordingly. There is no need to split an image stored on, or to be distributed from, a network location.

Conclusion

Once you become familiar with WinPE and applying it to network and removable media boot methods, using ImageX will fast become an essential and valuable PC deployment tool. The examples shown above assume you are using the correct x86, x64, or AMD64 version of ImageX for your system's architecture.

A comprehensive ImageX command-line reference is available here, within the entire Vista Technical Library. More practical documentation of ImageX and the whole WAIK is available in the WAIK.CHM file included with the WAIK installation.

Jim Aspinwall has been the Windows Helpdesk columnist and feature editor for CNET.com and is the author of three books on PC maintenance.


Return to the Windows DevCenter.