DISM commands

Deployment Image Servicing and Management

The base syntax is similar for nearly all DISM commands. After you have mounted or applied your Standard 8 image so that it is available offline as a flat file structure, you can specify any DISM option, the servicing command that will update your image, and the location of the offline image. You can use only one servicing command per command line. If you are servicing a computer that is running, you can use the/Online option instead of specifying the location of the offline Standard 8 image.

Benefits

You can use DISM with .wim files to:

ü  Capture and apply Windows images.

ü  Append and delete images in a .wim file.

ü  Split .wim files into several smaller files.

ü  You can use DISM with .wim, .vhd, or .vhdx files to:

ü  Add, remove, and enumerate packages.

ü  Add, remove, and enumerate drivers.

ü  Enable or disable Windows features.

ü  Apply changes based on theofflineServicingsection of an Unattend.xml answer file.

ü  Configure international settings.

ü  Upgrade a Windows image to a different edition.

ü  Prepare a WindowsPE image.

ü  Take advantage of better logging.

ü  Service earlier versions of Windows such as Windows7, Windows Server2008R2, WindowsVista with the latest Service Pack, and Windows Server2008.

ü  Service all platforms (32-bit, 64-bit).

ü  Service a 32-bit image from a 64-bit host, and service a 64-bit image from a 32-bit host. For more information, see the "Limitations" section later this topic.

ü  Make use of old Package Manager scripts.

Common Servicing and Management Scenarios

Image servicing and management solutions fall into two main categories:

ü  Managing the data or information included in the Windows image, such as enumerating or taking an inventory of the components, updates, drivers, or applications that are contained in an image, capturing or splitting an image, appending or deleting images within a .wim file, or mounting an image.

ü  Servicing the image itself, including adding or removing driver packages and drivers, modifying language settings, enabling or disabling Windows features, and upgrading to a higher edition of Windows.

ü  Here are some common scenarios for image servicing and management:

Tasks

·  Capture an image and save it as a .wim file.

·  List all images within a .wim, .vhd, or .vhdx file.

·  Manage several images in a single .wim file by appending, removing, or enumerating the images.

·  Prepare a WindowsPE image.

·  List information about a WindowsPE image.

·  Mount a Windows image.

·  List specific information about an image mounted from a .wim, .vhd, or .vhdx file, including where it is mounted, the mount status, and the index of each image in a .wim file.

·  List all drivers in an image or information about a specific driver.

·  Add out-of-box or boot-critical drivers to support new hardware.

·  Add operating-system updates such as hotfixes and Windows features.

·  Add or remove a language pack, and configure international settings.

·  List all international settings and languages in an image.

·  Troubleshooting through integrated status and logging.

·  Manage multiple image versions.

·  List all features in a package or specific information about a Windows feature.

·  Check the applicability of a Windows® Installer.msp file.

·  Update multiple Windows editions by updating a single image.

·  Upgrade to a higher edition of Windows.

·  List all of the Windows editions that an image can be upgraded to.

·  Apply settings in an Unattend.xml answer file.

·  Split a large .wim file into several smaller files to fit on selected media.

ONLINE COMMANDS

/Append-Image 4

/Apply-Image 4

/Capture-Image 5

/Cleanup-Mountpoints 5

/Commit-Image 6

/Delete-Image 6

/Export-Image 8

/Get-MountedImageInfo 8

/Get-ImageInfo 9

/List-Image 9

/Mount-Image 9

/Remount-Image 10

/Split-Image 10

/Unmount-Image 11

OFFLINE SERVICING

/Get-Help 11

/Log-Path: 11

/LogLevel:n 12

/Image: 12

/WinDir: 12

/Online 13

/SysDriverDir 13

/Quiet 13

/NoRestart 13

/ScratchDir: 13

/English 14

The base syntax for DISM is as follows:

DISM{/Image:path_to_offline_image_directory|/Online} [dism_options] {servicing_command} [servicing_argument]

Option / Argument / Description

/Append-Image

/ImageFile:path_to_image_file
/CaptureDir:source_directory
/Name:image_name
[/Description:image_description]
[/ConfigFile:<configuration_file.ini>]
[/Bootable]
[/CheckIntegrity]
[/Verify]
[/NoRpFix] / Adds an additional image to a .wim file.
/ConfigFilespecifies the location of a configuration file that lists exclusions for image capture and compress commands.
/Bootablemarks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commitoperations.
/CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verifychecks for errors and file duplication.
/NoRpFixdisables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If/NoRpFixis not specified, reparse points that resolve to paths outside of the value specified by/ImageFileare not be captured.

/Apply-Image

/ImageFile:
path_to_image_file
[/SWMFile:<pattern>]
/ApplyDir:target_directory
{/Index:< image_index|
/Name:image_name}
[/CheckIntegrity]
[/Verify]
[/NoRpFix] / Applies an image to a specified drive.
This command-line option does not apply to virtual hard disk (VHD) files.
/SWMFileenables you to reference split .wim files (SWMs).patternis the naming pattern and location of split files. You can also specify wildcard characters. For example, "E:\image\install*.swm" applies all of the split files in the E:\image directory named install1.swm, install2.swm, and so on.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations.
/CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verifychecks for errors and file duplication.
/NoRpFixdisables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If/NoRpFixis not specified, reparse points that resolve to paths outside of the value specified by/ImageFileare not be captured.

/Capture-Image

/ImageFile:path_to_image_file
/CaptureDir:source_directory
/Name:image_name
[/Description:
image_description]
[/ConfigFile:
<configuration_file.ini>]
[/Compress:{max|fast|none}]
[/Bootable]
[/CheckIntegrity]
[/Verify]
[/NoRpFix] / Captures an image of 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.
This command-line option does not apply to virtual hard disk (VHD) files.
Important:
DISM does not support extended attributes. DISM ignores extended attributes during a capture operation.
/ConfigFilespecifies the location of a configuration file that lists exclusions for image capture and compress commands.
/Compressspecifies the type of compression used for the initial capture operation. Themaximumoption provides the best compression, but takes more time to capture the image. Thefastoption provides faster image compression, but the resulting files are larger than those compressed by using themaximumoption. This is also the default compression type that is used if you do not specify the argument. The noneoption does not compress the captured image at all.
/Bootablemarks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Verifychecks for errors and file duplication.
/NoRpFixdisables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If/NoRpFixis not specified, reparse points that resolve to paths outside of the value specified by/ImageFileare not be captured.
Dism /Capture-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D

/Cleanup-Mountpoints

/ Deletes all of the resources associated with a mounted image that has been corrupted.
This command will not unmount images that are already mounted, nor will it delete images that can be recovered using the/Remount-Imagecommand.
Dism /Cleanup-Mountpoints

/Commit-Image

/MountDir:path_to_mount_directory
[/CheckIntegrity]
[/Append] / Applies the changes that you have made to the mounted image.
The image remains mounted until the/Unmount-Imageoption is used.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Appendadds the modified image to the existing .wim file instead of overwriting the original image.
The/CheckIntegrityand/Appendarguments do not apply to virtual hard disk (VHD) files.
Dism /Commit-Image /MountDir:C:\test\offline

/Delete-Image

/ImageFile:path_to_image_file
{/Index:image_index|
/Name:image_name}
[/CheckIntegrity] / Deletes the specified volume image from a .wim file that has 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.
This command-line option does not apply to virtual hard disk (VHD) files.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
Dism /Delete-Image /ImageFile:install.wim /Index:1

/Export-Image

{/SourceImageFile:path_to_image_file|/SWMFile:<pattern>}
{/SourceIndex:image_index|/SourceName:image_name}
/DestinationImageFile:path_to_image_file
[/DestinationName:<name>]
[/Compress:{max|fast|none}]
[/Bootable]
[/CheckIntegrity] / Exports a copy of the specified image to another 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, DISM stores additional resource files that increase the overall size of the image. Exporting the image will remove unnecessary resource files.
This command-line option does not apply to virtual hard disk (VHD) files.
/SWMFileenables you to reference split .wim files. pattern is the naming pattern and location of split files. You can also specify wildcard characters. For example, "E:\image\install*.swm" will export the split files in the E:\image directory named install1.swm, install2.swm, and so on.
/Compressspecifies the type of compression used for the initial capture operation. Themaximumoption provides the best compression, but takes more time to capture the image. Thefastoption provides faster image compression, but the resulting files are larger than those compressed by using themaximumoption. This is also the default compression type that is used if you do not specify the argument. Thenoneoption does not compress the captured image at all.
/Bootablemarks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:install2.wim

/Get-MountedImageInfo

/ Lists the images that are currently mounted and information about the mounted image such as whether the image is valid, read/write permissions, mount location, mounted file path, and mounted image index.
Dism /Get-MountedImageInfo

/Get-ImageInfo

/ImageFile:path_to_image_file
{/Index:image_index|/Name:image_name} / Displays information about the images that are contained in the .wim, vhd or .vhdx file. When used with the/Indexor/Nameargument, information about the specified image is displayed. The/Nameargument does not apply to VHD files. You must specify/Index:1for VHD files.
Dism /Get-ImageInfo /ImageFile:C:\test\offline\install.wim
Dism /Get-ImageInfo /ImageFile:C:\test\images\myimage.vhd /Index:1

/List-Image

/ImageFile:path_to_image_file
{/Index:image_index|
/Name:image_name} / Displays a list of the files and folders in a specified image.
This command-line option does not apply to virtual hard disk (VHD) files.
Dism /List-Image /ImageFile:install.wim /Index:1

/Mount-Image

/ImageFile:path_to_image_file
{/Index:image_index|
/Name:image_name}
/MountDir:path_to_mount_directory
[/ReadOnly]
[/Optimize]
[/CheckIntegrity] / Mounts an image from a .wim, .vhd or .vhdx file to the specified directory so that it is available for servicing.
/ReadOnlysets the mounted image with read-only permissions.
You can use /Optimize to reduce initial mount time.
Important:
When using the
/Optimizeargument, processes that are ordinarily performed during a mount will instead be completed the first time that you access a directory. As a result, there may be an increase in the time that is required to access a directory for the first time after mounting an image using the/Optimizeargument.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
Dism /Mount-Image /ImageFile:C:\test\images\myimage.wim /Index:1 /MountDir:C:\test\offline
Dism /Mount-Image /ImageFile:C:\test\images\myimage.vhd /Index:1 /MountDir:C:\test\offline /ReadOnly

/Remount-Image

/MountDir:path_to_mount_directory / Remounts a mounted image that has become inaccessible and makes it available for servicing.
Dism /Remount-Image /MountDir:C:\test\offline

/Split-Image

/ImageFile:path_to_image_file
/SWMFile:path_to_swm
/FileSize:size_in_MB
[/CheckIntegrity] / Splits an existing .wim file into multiple read-only split .wim files.
This option creates the .swm files in the specified directory, naming each file the same as the specifiedpath_to_swm, but with an appended number. For example, if you setpath_to_swm asc:\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 and saving it to the C:\ directory.
This command-line option does not apply to virtual hard disk (VHD) files.
/FileSizespecifies the maximum size in megabytes (MB) for each created file.
Note:
If a single file is larger than the value specified in the/FileSizeoption, one of the split .swm files that results will be larger than the value specified in the/FileSizeoption, in order to accommodate the large file
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
Dism /Split-Image /ImageFile:install.wim /SWMFile:split.swm /FileSize:650

/Unmount-Image

/MountDir:path_to_mount_directory
{/Commit|/Discard}
[/CheckIntegrity]
[/Append] / Unmounts the .wim, .vhd or .vhdx file and either commits or discards the changes that were made when the image was mounted.
You must use either the/Commitor/Discardargument when you use the/Unmount-Imageoption.
/CheckIntegritydetects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.
/Appendadds the modified image to the existing .wim file instead of overwriting the original image.
The/CheckIntegrityand/Appendarguments do not apply to virtual hard disk (VHD) files.
Dism /Unmount-Image /MountDir:C:\test\offline /Commit
Dism /Unmount-Image /MountDir:C:\test\offline /Discard

OFFLINE SERVICING

Option / Description

/Get-Help

[{/Image:path_to_offline_image_directory|/Online|