Using ImageX

2.3.3 ImageXImageX can be used as a command-line tool to create, apply, or manage WIM images. Three architecture-specific versions of ImageX–for 32-bit computers (x86), for regular 64-bit computers (x64 or amd64), and for Itanium-based computers (ia64)–are available in Windows Automated Installation Kit (WAIK). In previous blogs, we discussed how ImageX can be used to capture a generalized image on a Windows 7 installation on a computer. Let’s now discuss how to deploy that image on a target computer.
Windows deployment in an enterprise environment can be a complex topic. Depending on your goals and the size of the deployment, there are many technologies and methods that can be used. This article will only cover a few. We will only focus on the core process.
No matter how you look at it – installing Windows 7 boils down to applying WIM images to a destination volume on a target computer. A standard WIM image for Windows 7 is contained in a file called install.wim. It is located in the sources directory on a Windows 7 DVD. You can create a custom WIM file by generalizing an existing Windows 7 installation on a reference computer and then capturing it. You can automate the deployment by preparing all the settings and instructions in an answer document. Then, run Setup.exe from a command-line with the appropriate parameters.
We’ll use a manual process to demonstrate the deployment process. Let’s say you have one custom WIM image stored in a file called Custom.wim. This file can be found on a network share or on a USB flash drive. Open a Command Prompt window and boot the target computer. Next, use the Diskpart command line tool to create and format a system, boot, and additional volumes. Assign drive letters and mark the system volume active. You can use any drive letter. Windows 7 will remove the drive letter and assign the letter C to its boot volume. If you have created other volumes, it will assign letters alphabetically, starting with D to them. The following commands can be used to gain network access: ImageX and the WIM file you need to install may be on another computer.
Wpeinit net use DriveLetter: \\ServerName\ShareName /user:Domain\UserName password
The first command will initialize your network. The second command will map a drive to a network share. WinPE has not asked for credentials and your computer does not belong in any domains. To access the share, you will need to enter a username and password.
Let’s say that the system volume is currently C, and the boot volume D. The following command will install the WIM image onto the boot volume:
z:\imagex /apply y:\custom.wim 1 d:
The index of the WIM image is indicated by the 1 in the command. A.wim file can hold multiple images. Each image is assigned an index. This is simply an ordinal number. The command’s index is 1. This is because the Custom.wim file only contains one image. If you don’t know the contents of a.wim folder, you can locate their indexes and find out what they are using the Deployment Image Servicing and Management tool (DISM). The following command can be executed directly from WinPE’s Command Prompt window:
dism /get-wiminfo /wimfile:WIMFilePath\WIMFileName.wim
After installing the image to the boot volume, configure the system volume so that your computer can boot from it. All the code required is available here