Deployment Image Servicing and Management 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.

Deployment Image Servicing and Management (DISM.exe) installs, uninstalls, configures, and updates the features and packages in offline Windows® images and offline Windows Preinstallation Environment (Windows PE) images. The commands and options that are available for servicing an image depend on which Windows operating system you are servicing (Windows® 7, Windows Vista® with Service Pack 2 (SP2), Windows Vista® with Service Pack 1 (SP1), Windows Server® 2008 R2, Windows Server® 2008, or Windows PE), and whether the image is offline or a running operating system. All commands work on an offline Windows image. Subsets of the commands are available for servicing a running operating system.

The DISM command-line options are global and can be used with most servicing command-line options. The servicing command-line options work individually and cannot be used in combination with other servicing command-line options. A Windows image is made available for servicing by mounting the image or specifying a running operating system.

DISM replaces several Windows OEM Preinstallation Kit (Windows OPK) tools including PEImg, Intlcfg, and Package Manager.

DISM Command-Line Options

To service an offline Windows image, you must first mount the image. You can use Windows image (WIM) commands and arguments to mount a WIM image for servicing and management. You can also use these commands to list the indexes or verify the architecture for the image you are mounting. After you update the image, you must unmount it and either commit or discard the changes you have made.

The following commands can be used to mount, unmount, and query WIM files. These options are not case sensitive.

Option Argument Description

/Mount-Wim

/WimFile:<path_to_image.wim>

/Index:<image_index>

/Name:<image_name>

/MountDir:<path_to_mount_directory>

/ReadOnly

Mounts the WIM file to the specified directory so that it is available for servicing.

/ReadOnly sets the mounted image with read-only permissions. Optional.

Note
An index or name value is required for most operations that specify a WIM file.

Example:

Dism /Mount-Wim /WimFile:C:\test\images\install.wim /index:1 /MountDir:C:\test\offline /ReadOnly
Dism /Mount-Wim /WimFile:C:\test\offline\install.wim /name:"Windows Vista HomeBasic" /MountDir:C:\test\offline

/Commit-Wim

/MountDir:<path_to_mount_directory>

Applies the changes you have made to the mounted image. The image remains mounted until the /unmount option is used.

Example:

Dism /Commit-Wim /MountDir:C:\test\offline

/Unmount-Wim

/MountDir:<path_to_mount_directory>

{/Commit | /Discard}

Unmounts the WIM file and either commits or discards the changes that were made while the image was mounted.

Example:

Dism /Unmount-Wim /MountDir:C:\test\offline /commit
Dism /Unmount-Wim /MountDir:C:\test\offline /discard

/Remount-Wim

/MountDir:<path_to_mount_directory>

Remounts a mounted WIM file that has become inaccessible and makes it accessible for servicing.

Example:

Dism /Remount-Wim /MountDir:<path_to_mount_directory>

/Cleanup-Wim

 

Deletes all of the resources associated with a mounted WIM image that has been abandoned. This command will not unmount currently mounted images, nor will it delete images that can be remounted.

Example:

Dism /Cleanup-Wim

/Get-WimInfo

/WimFile:<path_to_image.wim>

/Index:<Image_index>

/Name:<Image_name>

Displays information about the images within the WIM. When used with the /Index or /Name option, information about the specified image is displayed.

Example:

Dism /Get-WimInfo /WimFile:C:\test\offline\install.wim /index:1

/Get-MountedWimInfo

Lists the images that are currently mounted and information about the mounted image such as read/write permissions, mount location, mounted file path, and mounted image index.

Example:

Dism /Get-MountedWimInfo

The base syntax for nearly all DISM commands is the same. After you have mounted or applied your Windows image so that it is available offline as a flat file structure, you can specify any DISM options, 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 running computer, you can use the /Online option instead of specifying the location of the offline Windows Image.

The base syntax for DISM is:

DISM.exe {/Image:<path_to_image> | /Online} [dism_options] {servicing_command} [<servicing_argument>]

The following DISM options are available for an offline image.

DISM.exe /image:<path_to_offline_image_directory> [/WinDir:<path_to_%WINDIR%>] [/LogPath:<path_to_log_file.log>] [/LogLevel:<n>] [SysDriveDir:<path_to_bootMgr_file>] [/Quiet] [/NoRestart] [/ScratchDir:<path_to_scratch_directory>]

The following DISM options are available for a running operating system.

DISM.exe /online [/LogPath:<path_to_log_file>] [/LogLevel:<n>] [/Quiet] [/NoRestart] [/ScratchDir:<path_to_scratch_directory>]

The following table provides a description of how each DISM option can be used. These options are not case sensitive.

Option Description

/Get-Help

/?

Displays information about available DISM command-line options and arguments.

The options that are available for servicing an image depend on the servicing technology that is available in your image. Specifying an image, either an offline image or the running operating system will generate information about specific options that are available for the image you are servicing.

Example:

Dism /?
Dism /image:C:\test\offline /?
Dism /online /?

You can display additional Help by specifying a command-line option.

Example:

Dism /image: C:\test\offline /Add-Driver /?
Dism /image:C:\test\offline /Add-Package /?
Dism /online /Get-Drivers /?

/LogPath:<path to log file.log>

Specifies the full path and file name to log to. If not set, the default is: %WINDIR%\Logs\Dism\dism.log

Important
In Windows PE, the default directory is the RAMDISK scratch space which can be as low as 32 MB.

The log file will automatically be archived. The archived log file will be saved with .bak appended to the file name and a new log file will be generated. Each time the log file is archived the .bak file will be overwritten.

When using a network share that is not joined to a domain, use the net use command with domain credentials to set access permissions before you set the log path for the DISM log.

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /Add-Package /PackagePath:C:\packages\package.cab

/LogLevel:<n>

Specifies the maximum output level shown in the logs. The default log level is 3. The accepted values are:

1 = Errors only

2 = Errors and warnings

3 = Errors, warnings, and informational

4 = All the above and debug output

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /LogLevel:1 /Add-Package /PackagePath:C:\packages\package.cab

/Image:<path_to_offline_image_directory>

This is the full path to the root directory of the offline Windows image that you will service. If the directory named Windows is not a subdirectory of the root directory, /WinDir must be specified.

This option cannot be used with /Online.

Example:

Dism /image:C:\test\offline /LogPath:AddPackage.log /LogLevel:1 /Add-Package /PackagePath:C:\packages\package.cab

/WinDir:<path_to_%WINDIR%>

Used with the /Image option to specify the path to the Windows directory relative to the image path. This cannot be the full path to the Windows directory; it should be a relative path. If not specified, the default is the Windows directory in the root of the offline image directory.

This option cannot be used with the /Online option.

Example:

Dism /image:C:\test\offline /WinDir:WinNT /Add-Package /PackagePath:C:\packages\package.cab

/Online

Specifies that the action is to be taken on the operating system that is currently running.

This option cannot be used with the /Image or the /WinDir option. When /Online is used the Windows directory for the online image is automatically detected.

Example:

Dism /online /Get-Packages

/SysDriveDir:<path_to_sysdrive_directory>

Specifies the path to the location of the BootMgr files. This is necessary only when the BootMgr files are located on a partition other than the one containing the Windows directory and when the BootMgr files need to be serviced.

This option is not necessary if you are servicing an applied image because system partitions are not part of the WIM file.

Example:

Dism /image:C:\test\offline /SysDriveDir:C:\

/Quiet

Turns off information and progress output to the console. Only error messages will be displayed.

To run in quiet mode, this option must be set every time that the command-line utility is run. It must be present before the servicing command.

Note

Do not use the /Quiet option with /Get commands. No information will be displayed.

Example:

Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package.cab /quiet

/NoRestart

Suppresses reboot. If a reboot is not necessary, then this command does nothing. This option will keep the application from prompting for a restart (or keep it from restarting automatically if the /Quiet option is used).

Example:

Dism /online /Add-Package /PackagePath:C:\packages\package.cab /NoRestart /quiet

/ScratchDir:<path_to_scratchdirectory>

Specifies a temporary directory to be used when extracting files for temporary use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used, with a subdirectory name of randomly generated hexadecimal value for each run of DISM. Items in the scratch directory are deleted after each operation.

You should not use a network share location as a scratch directory to expand a package (.cab or .msu file) for installation. The directory used for extracting files for temporary usage during servicing should be a local directory.

Example:

Dism /image:C:\test\offline /ScratchDir:C:\Scratch /Add-Package /PackagePath:C:\packages\package.cab

/English

Displays command-line output in English.

Note

Some resources cannot be displayed in English.
This option is not supported when using the DISM /? command.

Example:

Dism /Get-WimInfo /WimFile:C:\test\offline\install.wim /index:1 /English

Servicing Command-Line Options

Depending on the image you have specified (Windows 7, Windows Vista with SP2, Windows Vista with SP1, Windows Server 2008 R2, Windows Server 2008, or Windows PE) and whether the image is offline or a running operating system, servicing commands and arguments might be available for the following types of updates:

Note

You cannot use two different types of servicing commands in the same command line.

See Also

Concepts

Deployment Image Servicing and Management Technical Reference
What Is Deployment Image Servicing and Management?
How Deployment Image Servicing and Management Works