Share via


ImageX Command-Line Options

Applies To: Windows 7

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

ImageX is a command-line tool in Windows® 7 that you can use to create and manage Windows image (.wim) files. A .wim file contains one or more volume images, disk volumes that contain images of an installed Windows operating system.

To modify your volume images, you must install the Windows Imaging File System Filter (WIMMount Filter) driver on a computer running Windows 7 or Windows Server® 2008. Installing the WIMMount Filter driver enables you to mount a .wim file as if it were a directory and to browse, copy, paste, and edit the volume images from a file-management tool, such as Windows Explorer, without extracting or recreating the image.

Important

You must run each of these command-line options individually. If you do not provide a location for your captured .wim file, the process automatically creates it in your ImageX directory. For example, if you enter Data.wim instead of D:\Imaging\Data.wim while using the /capture option, the Data.wim file appears in your ImageX directory.

ImageX Command-Line Options

ImageX command-line options use the following conventions.

imagex [flags] {/append | /apply | /capture | imagex /cleanup | /commit | /delete | /dir | /export | /info | /split | /logfile | /mount | /mountrw | /unmount} [parameters]

The following list shows the valid syntax used for each ImageX operation type.

  • imagex /append image_path image_file {"description"} {/boot | /check | /config configuration_file.ini | /scroll | /verify | /logfile }

  • imagex /apply image_file image_number image_name image_path {/check | /ref | /scroll | /verify | /logfile}

  • imagex /capture image_path image_file "name" {"description"} {/boot | /check | /compress [type] | /config | /norpfix | /scroll | /verify| /logfile}

  • imagex /cleanup

  • imagex /commit mount_path image_name {/logfile}

  • imagex /commit /append mount_path new_image_name {/logfile}

  • imagex /delete image_file image_number image_name {/check| /logfile}

  • imagex /dir image_file image_number image_name {/logfile}

  • imagex /export src_file src_number src_name dest_file dest_name {/boot | /check | /compress [type] | /ref [splitwim.swm] | /logfile}

  • imagex /info img_file [img_number | img_name] [new_name] [new_desc] {/boot | /check| /logfile}

  • imagex /mount image_file image_number image_name image_path {/check| /logfile}

  • imagex /mountrw image_file image_number image_name image_path {/check| /logfile}

  • imagex /split image_file dest_file size {/check| /logfile}

  • imagex /unmount image_path {/commit| /logfile}

  • imagex /remount image_path {/logfile}

Operation Description

imagex /append image_path image_file {"description"}{/boot | /check | /config configuration_file.ini | /scroll | /verify | /logfile filename.log}

Appends a volume image to an existing Windows image (.wim) file. Creates a single instance of the file, comparing it against the resources that already exist in the .wim file, so that you do not capture the same file twice.

Important
Ensure that you have enough disk space for the /append option to run. If you run out of disk space during the /append option, you might corrupt the appended .wim file.

Important

The .wim file can have only one assigned compression type; therefore, you can only append files with the same compression type.

image_path

Specifies the name and the location of the existing .wim file to append.

image_file

Specifies the name and the location of the volume image that appends the existing file.

"description"

Specifies the text that provides additional reference information.

Important

The straight quotation marks are required.

You can also set the following options:

/boot

Marks a volume image as bootable. This option applies only to Windows PE images. Only one volume image can be marked as bootable in a .wim file.

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/configconfiguration_file.ini

Specifies the name and the location of the configuration file. You can rename the configuration file, as necessary.

/NORPFIX

Disables the reparse point tag fix-up. A reparse point is a file that contains a link to another file on the file system. If not provided, reparse points that resolve to paths outside of the image_path will not be captured.

/scroll

Scrolls output for redirection.

/temp

Specifies the path where temporary files are stored.

/verify

Enables file-resource verification by checking for errors and file duplication during capture and apply operations. By default, this option is enabled during networking operations.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /append D: D:\imaging\data.wim "Drive D" /verify

imagex /apply image_file image_numberimage_name image_path {/check |/norpfix | /ref | /scroll | /temp| /verify | /logfile filename.log}

Applies a volume image to a specified drive.

Important

You must run this option from Windows PE.

image_file

Specifies the name and the location of the volume image applied to the directory.

image_number

Specifies the number of the specific volume within the .wim file.

image_name

Specifies the name of the image in the .wim file.

image_path

Specifies the file path where the image will be applied.

You must create all hard disk partitions before beginning this process, unless you run this option by using a script. If you use the /apply option for a directory structure, the option will include the specified directory, including all subdirectories and files.

Important

You must include the parent directory for the /apply option. Otherwise, when the image is applied, it will overwrite everything in that location. For example, if you apply the image to the C drive, the /apply option overwrites everything that exists on the C drive with your image files.
To automate the creation of a directory, you must add the mkdirtarget_directory command to your script before executing the imagex /apply command.

You can also set the following options:

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/norpfix

Disables the reparse point tag fix-up. A reparse point is a file that contains a link to another file on the file system. If not provided, reparse points that resolve to paths outside of the image_path will not be captured.

/refsplitwim.swm

Enables you to reference split .wim files (SWMs). splitwim.swm is the name and location of additional split files. Wildcards are accepted. For more information about split .wim files see, Split an Image.

/scroll

Scrolls output for redirection.

/temp

The path where temporary files are stored.

/verify

Enables file-resource verification by checking for errors and file duplication during capture and apply operations. By default, this option is enabled during networking operations.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /apply D:\imaging\data.wim 1 D:\New_Directory /verify

imagex /capture image_path image_file name {"description"} {/boot | /check | /compress [type] | /config | /norpfix | /scroll | /temp | /verify| /logfile filename.log}

Captures a volume image from a drive to a new .wim file. Captured directories include all subfolders and data. You cannot capture an empty directory. A directory must contain at least one file.

Note

ImageX does not support extended attributes. ImageX will ignore extended attributes during a capture operation.

During the capture operation, fast compression is automatically applied. If you require a different compression type, use the /compress option.

image_path

Specifies the name and the location of the volume image for capture.

image_file

Specifies the name and the location of the new .wim file.

file name

Specifies the name of the new .wim file.

Important

This value is required. The straight quotation marks are required.

"description"

Specifies the text that provides additional reference information. This value is optional. The straight quotation marks are required.

You can also set the following options:

/boot

Marks a volume image as bootable. Available only for Windows PE images. Only one volume image can be marked as bootable within a .wim file.

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/compress [maximum | fast | none]

Specifies the type of compression used for the initial capture operation. The maximum option provides the best compression, but takes the longest time to capture the image. The fast option provides faster image compression, but the resulting files are larger than those compressed with the maximum option. This is also the default compression type, which will be used if you leave this parameter blank. The none option does not compress the captured image at all.

Note

While the compression type that you choose affects the capture time, it only slightly affects the apply time.

/config configuration_file.ini

Specifies the name and the location of the configuration file. You can rename this file, as necessary.

Note

If you rename your Configuration_list.ini file to Wimscript.ini and store it in your ImageX directory (where the ImageX.exe file is located), it will automatically run when you run the /capture option, without requiring you to use the /config option.

/scroll

Scrolls output for redirection.

/temp

Specifies the path where temporary files are stored.

/verify

Enables file-resource verification by checking for errors and file duplication during capture and apply operations. By default, this option is enabled during networking operations.

Note

The /verify option will affect the overall capture time. During a capture operation, the progress bar indicates the status of the capture operation only, not the verify operation. When the capture is complete, the verify process begins. This process takes time, even though the progress bar shows 100 percent.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /capture D: D:\imaging\data.wim "Drive D" /verifyimagex /compress fast /check /scroll /capture C: D:\install.wim "Windows 7"

imagex /cleanup

Deletes all the resources associated with a mounted image that has been abandoned. This command will not unmount currently mounted images, nor will it delete images that can be recovered via the imagex /remount command. For example,

imagex /cleanup

If you mount an image during a Windows PE session and the computer reboots, the mounted directory becomes corrupt. The ImageX /Cleanup command is not supported. Use the ImageX /Unmount command to unmount the corrupted directory, and then remount the image.

imagex /commit mount_path {/append mounted_path image name}

Saves changes to a mounted .wim file without unmounting the .wim file. You can also set the following option:

imagex /commit C:\mounted_images

/append

Appends the mounted image to the existing .wim file. If you use this option, you must specify a name for the new image. For example,

imagex /commit /append C:\mounted_images new_image

imagex /delete image_file image_number image_name{/check | /temp| /logfile filename.log}

Deletes the specified volume image from a .wim file with multiple volume images. This option deletes only the metadata entries and XML entries. It does not delete the stream data and does not optimize the .wim file.

Once the file is mounted, you can view, but not modify, all the information contained in the directory. If you do not specify the parameters to mount, this option will list all mounted images.

image_file

Specifies the name and the location of the .wim file specified for deletion.

image_number

Specifies the number of the specific volume within the .wim file.

Important

You must run this option from Windows PE. There must always be at least one volume image in a .wim file, so you can only delete a volume image if more than one image exists.

image_name

Specifies the name that references the image in the .wim file.

You can also set the following option:

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/temp

Specifies the path where temporary files are stored.

For example,

imagex /delete D:\imaging\data.wim 1

imagex /dir image_file image_numberimage_name

Displays a list of the files and folders within a specified volume image.

image_file

Specifies the name and the location of the volume image for review. If you do not provide a volume image, this option returns a directory listing for all volume images in the .wim file.

image_number

Specifies the number of the specific volume within the .wim file.

image_name

Specifies the name that references the image in the .wim file.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /dir D:\imaging\data.wim 1

imagex /export src_file src_numbersrc_name dest_file dest_name {/boot | /check | /compress [type] | /ref [splitwim.swm] /temp| /logfile filename.log}

Exports a copy of the specified .wim file to another .wim file. The source and destination files must use the same compression type. You can also optimize an image by exporting to a new image file. When you modify an image, ImageX stores additional resource files that increase the overall size of the image. Exporting the image will remove unnecessary resource files.

Important

Ensure that you have enough disk space for the /export option to run. If you run out of disk space while the /export option runs, you might corrupt the Destination.wim file.

src_file

Specifies the file path of the .wim file that contains the image to be copied.

src_number

Specifies the number of the specific volume within the .wim file.

src_name

Specifies the name that identifies the image in the source .wim file.

dest_file

Specifies the file path of the .wim file that will receive the image copy.

dest_name

Specifies the unique name for the image in the destination .wim file.

You can also set the following options:

/boot

Marks a volume image as bootable. This option is available only for Windows PE images. Only one volume image can be marked as bootable within a .wim file.

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

Important

If the image being exported was captured using the /check option, then the /check option will be automatically used.

/compress [maximum | fast | none]

Specifies the type of compression used for the initial capture operation. The maximum option provides the best compression, but takes the longest time to capture the image. The fast option provides faster image compression, but the resulting files are larger than those compressed with the maximum option. This is also the default compression type, used if you leave this parameter blank. The none option does not compress the captured image at all.

/refsplitwim.swm

Enables the reference of split .wim files (SWMs). splitwim.swm is the name and location of additional split files. Wildcards are accepted.

/temp

The path where temporary files are stored.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /export D:\imaging\data.wim 1 D:\imaging\sample.wim

imagex /info img_file [img_number | img_name] [new_name] [new_desc] {/boot | /check | /temp | /xml| /logfile filename.log}

Returns the stored XML descriptions for the specified .wim file, including, but not limited to, the total file size, the image index number, the directory count, file count, and a description.

image_file

Specifies the name and the location of the .wim file for XML data review.

image_number

Specifies the number that identifies an image in the .wim file.

image_name

Specifies the name that identifies an image in the .wim file.

new_name

Specifies the new unique name for the specified image.

new_desc

Specifies the new description for the specified image.

You can also set the following options:

/boot

Marks a volume image as bootable. Available only for Windows PE images. Only one volume image can be marked as bootable within a .wim file.

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/temp

Specifies the path where temporary files are stored.

/XML

Specifies the path where temporary files are stored.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /info D:\imaging\data.wim

imagex /mount image_fileimage_numberimage_nameimage_path {/check| /logfile filename.log}

Mounts a .wim file from Windows Server 2003 with Service Pack 1 (SP1), Windows Vista, or Windows 7 with read-only permission to a specified directory.

Once the file is mounted, you may view, but not modify, all the information contained in the directory.

Important

You must install the WIMMount filter before you can mount an image.

image_file

Specifies the path of the .wim file containing the specified image.

image_number

he number that references the specific volume within the .wim file.

image_name

he name that references the image in the .wim file.

image_path

he file path where the specified image will be mounted.

You can also set the following flag:

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/logfile filename.log

A plain text file that stores ImageX command events.

When mounting a Windows image file, a sharing violation may occur if another application (for example, antivirus-protection or search-indexing application) attempts to access a file within the mounted directory. To fix this issue, disable the application accessing the file and repeat the mount operation.

For example,

imagex /mount D:\imaging\data.wim 2 C:\mounted_images

imagex /mountrw image_file image_numberimage_name image_path {/check| /logfile filename.log}

Mounts a .wim file from Windows Server 2003 with Service Pack 1 (SP1), Windows Vista or Windows 7 with read/write permission to a specified directory.

Once the file is mounted, you can view and modify all the information contained in the directory.

Important

You must install the WIMMount filter before you can mount an image. Disable System Restore when running Windows image filter. Windows imaging filter may fail when copying files into the mount point. On Windows Server 2003, running the xcopy command against a Windows image mounted from DVD or CD may cause system failure. Do not run the xcopy command during the mount.

The /mountrw option requires exclusive access to the .wim file; therefore, you cannot use the /mountrw option if an image is currently mounted using the /mount option or the /mountrw option.

Important

You must not mount an image to the parent or the subdirectories of an already-mounted directory. Upon mounting an image to a directory that contains files, the existing files will be masked until you run the /unmount option. Additionally, you must not mount your image to Windows reserved folders.

image_file

Specifies the name and location of the .wim file to mount with read/write permission.

image_number

Specifies the number that references the specific volume within the .wim file.

image_name

Specifies the name that references the image in the .wim file.

image_path

Specifies the file path where the specified image will be mounted.

You can also set the following option:

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /mountrw  D:\imaging\data.wim 2 C:\mounted_image

imagex /split image_file dest_file  size {/check| /logfile filename.log}

Splits an existing .wim file into multiple read-only split .wim files (.swm).

image_file

Specifies the name and location of the .wim file to split.

dest_file

Specifies the file path of the split files.

size

Specifies the maximum size in megabytes (MB) for each created file.

This option generates the .swm files into the specified directory, naming each file the same as the specified image_file, but with an appended number and the .swm file-name extension. For example, if you choose to split a file named Data.wim, this option creates a Data.swm file, a Data2.swm file, a Data3.swm file, and so on, defining each portion of the split .wim file.

Note

If a single file is larger than the value specified for size, one of the split .swm files that results will be larger than the value specified for size, in order to accommodate the large file.

You can also set the following option:

/check

Checks the integrity of the .wim file. Enables you to detect when an image becomes corrupt or altered. This option is recommended during capture operations. If not provided, existing checks are removed.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /split D:\imaging\data.wim 600

imagex /unmount image_path {/commit| /logfile filename.log}

Unmounts the mounted image from a specified directory.

Important

Confirm that you have enough hard disk space to add the files for your image. You must account for the size of the files that you add to the .wim file, plus any increase in file size due to the modification of existing files, minus any files that you deleted, before performing the /commit option. If you do not have enough hard disk space, an error will occur.
The unmount operation may perform slower than normal if you mounted multiple images to directories on the same volume at the same time. If you need to mount multiple images at the same time, it is recommended that you mount the images to directories on different volumes.

image_path

Specifies the complete directory location to unmount the files. If you do not specify a directory, this option will list all mounted images.

You can also set the following option:

/commit

Saves the changes made to the mounted image.

Important

If you use the /unmount option without the /commit option, your changes will be discarded. To be able to save your changes, you must mount the image by using the /mountrw option and use the /commit option when unmounting the image.

/append

Appends the mounted image to the existing .wim.

/logfile filename.log

A plain text file that stores ImageX command events.

For example,

imagex /unmount /commit C:\mounted_images

imagex /remount image_path {/logfile filename.log}

Recovers an orphaned mount path. This option is not supported from a rebooted Windows PE environment.

image_path

/logfile filename.log

A plain text file that stores ImageX command events.

The path to be remounted. If not specified, lists all images. For example,

imagex /remount C:\mounted_images

See Also

Concepts

What Is ImageX?
How ImageX Works