Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Automating the Deployment of Windows 7 : Imaging with the Windows Automated Installation Kit (part 1) - ImageX

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
5/17/2011 11:46:05 AM


Multiple versions of the Windows AIK exist. Make sure you have the version for Windows 7. In addition, if you've installed a service pack on Windows 7, you should check to see if a newer version of the Windows AIK has been released. The Windows AIK can be found at Microsoft's download site at http://www.microsoft.com/downloads by searching for "Windows 7 AIK."


In this section, you'll learn how to use more of the tools to capture, deploy, and modify images. Using images for deployments is a primary method of automating deployments of Windows 7, and you have several tools available to help you. These include

  • ImageX

  • Deployment Image Servicing and Management

  • Preinstallation environment tools

  • Windows System Image Manager

1. ImageX

The ImageX command-line tool is part of the set of deployment tools installed when you install the Windows AIK. It can be used to capture, deploy, modify, and inspect images.

You can access the ImageX application via the Deployment Tools Command Prompt by selecting Start => All Programs => Microsoft Windows AIK => Deployment Tools Command Prompt. When running ImageX within Windows 7, you'll need administrative permissions for most of the switches, so you should start it by right-clicking and selecting Run As Administrator.

One of the ways that ImageX is used is within the Windows Preinstallation Environment. You can create a bootable disk, such as a bootable USB disk or bootable CD, and copy the ImageX.exe program to the bootable media. You can then boot to a system with this bootable media and use ImageX to capture and/or deploy images.

ImageX can also be used on the technician's computer to manage .wim files. You can inspect .wim files to identify the images within it and extract the files within an image by mounting the image with ImageX. You can even modify these extracted files and save them back to the original image.

The following section covers many of the switches you'll use with ImageX to do common tasks. If you want to see a complete list of all the switches available with ImageX, check out the help article titled "ImageX Command-Line Options" in the Windows Automated Installation Kit User's Guide for Windows 7.

As you go through the following explanations, I strongly encourage you to execute all the commands you can. Although you may not have all the information necessary to capture or deploy an image yet, you should be able to execute ImageX with many of the other switches including /info, /mount, /unmount, and /dir.


1.1. Capturing Images

You can capture the image of a reference computer using the /capture switch. The reference computer must have had Sysprep run on it for this to work. You would then boot to the PE on the reference computer and run ImageX with the /capture switch.

This switch requires three parameters:

  • The first parameter is the drive of the operating system (such as C:).

  • Next you provide the path to the location where the image will be stored and the name of the image file. The specified folder must exist or the command will fail.

    • If the image file doesn't exist, it will be created.

    • If the file does exist, it will be overwritten. If you want to add the image as an additional image within an existing .wim file, substitute the /capture switch with the /append switch.

  • The last parameter is the name of the image.

In the following command, the image is being captured from the C: drive, stored in the Win7.wim image file in the C:\images folder, and named "Windows 7".

ImageX /capture c: c:\images\Win7.wim "Windows 7"

1.2. Deploying Images

You can deploy an image to a system with the /apply switch. This allows you to deploy an image that has been captured from a reference computer. You would boot to a system using bootable media and then use ImageX with the /apply switch to apply an image contained within a .wim file. The file could be available on the destination computer, on a USB drive, or via a network share.

The /apply switch needs three parameters:

  • First, you need to provide the path and name of the .wim file.

  • Next, you need to provide an image identifier to identify the image uniquely within the .wim file. Remember, any .wim file can hold multiple images. You can identify the image with the index number of the image or the image name. If the image is the first image in the .wim file, the index is 1.

  • Last, you need to provide the drive (such as C: or D:) where the image will be deployed.

As an example, if you booted to the PE from a USB disc that included ImageX, you could use the following command to load the first image within the Win7.wim file to the C: drive.

ImageX /apply F:\Images\Win7.wim 1 C:

1.3. Viewing Information about an Image

A common question you may have about any .wim file is, "What's in there?" You can easily answer this question with the /info switch. It allows you to view detailed information about an existing image, including how many images are within the .wim file, the image index of each image, and other details on the image.

The result is displayed in XML format. Nodes are contained within < > symbols. For example, the image index is displayed as <IMAGE INDEX="1"> for the first image in the file and <IMAGE INDEX="4"> for the fourth image within the .wim file. The image index is valuable to have because you need to know it when deploying and mounting images.

As an example, the following output shows a partial printout after querying a .wim file with the /info switch. There are about 35 extra lines within the <IMAGE> node providing details such as when it was created, when it was last modified, and Windows version information. Execute the command against your .wim file to see all the results.

Available Image Choices:
------------------------
<WIM>
<TOTALBYTES>185270805</TOTALBYTES>
<IMAGE INDEX="1">
. . .
</IMAGE>
</WIM>

The /info switch takes a single parameter—the path and name of the .wim file. For example, the following command will retrieve information from the install.wim file located on the installation DVD (where the installation DVD is assigned drive F:).

ImageX /info F:\sources\install.wim

1.4. Mounting Images

When you mount an image, it extracts all of the files for a specific image from a .wim file. You can compare this to unzipping a .zip file or extracting files from a Microsoft cabinet (.cab) file; the original .zip file and .cab file still exist, but now you have a new directory holding all of the files that were in the original files.

A mounted image is different from a zipped or cabinet file in that the system will track all mounted images, and they are not intended to stay mounted. Instead, you mount the image so that you can inspect, copy, and/or modify the files within the image. Once you've finished, you use the /unmount switch to unmount the image and delete all the extracted files.

If you mount an image with the /mountrw switch (notice the rw), you can modify the extracted files and save these changes back to the original image. If you mount an image with the /mount switch, changes to any files cannot be saved to the original image.

The /mount and /mountrw switches take three parameters:

  • The first parameter is the path and the name of the .wim file.

  • Next is the name or number of the image within the .wim file.

  • Last, you provide a path to the location where you want to extract the image.

The following command will open the install.wim file (located in \sources on the installation DVD, which has been assigned the drive letter G: on my system), extract the first image (1), and store all the image files from this image into a folder named C:\Win7Mount. Try it.

ImageX /mount g:\sources\install.wim 1 C:\Win7Mount

If you want to make changes to the source image, change the /mount switch to /mountrw.

1.5. Unmounting Images

Mounted images can be unmounted using the /unmount switch. This will remove all of the files and folders of a mounted image. Images that have been mounted will take a considerable amount of space on your disk and are tracked by the operating system. A mounted image will still be available after a reboot. This includes the extracted files and also ImageX's ability to see the mounted image.

You should not delete the mounted image with Windows Explorer. While it is possible to delete all of the files and folders of the mounted image using Windows Explorer, ImageX will still try to track it and will generate errors until it is properly unmounted.

The /unmount switch accepts a single parameter—the mount path, or path to the mounted folder. For example, if the image was mounted in the C:\Win7Mount folder (as shown in the /mount explanation previously), you can use the following command to unmount it:

ImageX /unmount c:\Win7Mount

You can also view a list of all mounted images by using the /unmount switch without any parameters, like this:

ImageX /unmount

The output is provided in the following text. Notice both the Mount Path and the source Image File are identified. If the image was mounted with /mount, Mounted R/W will be a 0 (indicating read mode), and if the image was mounted with /mountrw, Mounted R/W will be a 1 (indicating read/write mode).

Listing all mounted images...
1.
Mount Path ....:[c:\Images\Mount]
Image File ....:[c:\Images\install.wim]
Image Index ...:[1]
Mounted R/W ...:[0]

1.6. Modifying Images

If you've mounted an image using the /mountrw switch, you can make modifications to the files and then save them back to the original image. This can be much quicker then re-creating a reference computer, running Sysprep again, and recapturing the image.

As a reminder, when you mount an image, it extracts all of the files for a specific image from a .wim file. You can now add files, delete files, and modify these files. A common reason to do this is to add driver files, but it's possible to add other files such as scripts or application packages.

When you've finished making changes, you can commit the changes to the image file with the /unmount /commit switches. If you try to use the /commit switch on an image that was mounted with the /mount switch, it will respond with an error.

When using the /unmount and /commit switches, you must provide only one parameter—the mount path. As an example, if an image was mounted to the C:\Win7Mount folder, the following command will commit the changes to the source .wim file that was used to mount the image.

ImageX /unmount /commit c:\Win7Mount

1.7. Creating New Modified Images

You may want to use an existing image as a baseline and create new images from this baseline. You can do so by using the /commit and /append switches. When doing this, you will not use the /unmount switch right away but will later unmount the mounted image after the new images have been created.

The process for this is as follows:

  • Mount an image using the /mountrw switch.

  • Modify the image as desired.

  • Save the mounted image as a new image in a .wim file using the /commit and /append switches.

  • Unmount the image (without using /commit).

The /append switch will add the image to an existing .wim file.

1.8. Deleting Images

You can delete images from a .wim file using the /delete switch. Obviously, you would want to delete an image only if you're sure you will never need it again. The .wim files don't include a Recycle Bin.

The /delete switch needs two parameters:

  • The first parameter is the name and path to the .wim file.

  • The second parameter is the index, or number of the image within the .wim file.

As an example, the following command will delete the second (2) image within the Win7.wim file stored in the C:\Images folder:

ImageX /delete c:\images\Win7.wim 2

1.9. Viewing a List of Files in an Image

If you just want to view a list of the files in an image without mounting it, you can do so with the /dir switch. The output will be extensive, so you may want to capture the results in a text file.

The /dir switch needs two parameters:

  • The first parameter is the name and path to the .wim file.

  • The second parameter is the index, or number of the image within the .wim file.

As an example, the following command will provide a list of files and folders within the first image of the Win7.wim file stored in the C:\Images folder.

ImageX /dir c:\images\Win7.wim 1

This can be an extensive list. If you want to direct the output to a text file, you can use the > redirector as follows:

ImageX /delete c:\images\Win7.wim 1 > Win7Dir.txt

1.10. Logging ImageX Results

Most of the ImageX commands can be used with the /logfile switch to create a log that you can use to view progress. The command-line output is minimal, but if you want additional results, just add the /logfile switch with the name of a log file in the format of name.log.

As an example, if you wanted to capture a log file to view the results of mounting an image, you could use the following command:

ImageX /mount g:\sources\install.wim 1 C:\Win7Mount /logfile mylog.log

Not all switches support the addition of the /logfile switch, but most do.

1.11. Splitting Image Files

If your .wim file is too big for the media where you want to store it, you can use the /split switch to split it into multiple read-only .swm (split .wim) files.

The /split switch needs two parameters:

  • The first parameter is the name and path to the .wim file.

  • The second parameter is the size in megabytes (MB) for each split file.

As an example, the following command will split the Win7.wim file into several 650MB files so that it can be stored on several CDs.

ImageX /split c:\images\Win.wim 650

The first .swm file will be named Win.swm, the next will be named Win2.swm, the next Win3.swm, and so on. Split .wim files can be deployed to a computer using the /apply and the /ref switches.

Other -----------------
- Automating the Deployment of Windows 7 : Choosing a Deployment Strategy
- Automating the Deployment of Windows 7 : Understanding and Designing Images
- Planning for the Installation of Windows 7 : Planning and Managing Client Licensing and Activation (part 2)
- Planning for the Installation of Windows 7 : Planning and Managing Client Licensing and Activation (part 1)
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 3) - Installing Integration Components
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 2) - Windows XP Mode
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 1) - Considering a VDI Environment
- Planning for the Installation of Windows 7 : Designing User State Migration
- Planning for the Installation of Windows 7 : Local Installation
- Planning for the Installation of Windows 7 : Choosing a Windows 7 Edition
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server