DISM Operating System Package Servicing Command-Line Options

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

Operating system package-servicing commands can be used offline to install, remove, or update Windows® packages provided as cabinet (.cab) or Windows Update Stand-alone Installer (.msu) files. Packages are used by Microsoft® to distribute software updates, service packs, and language packs. Packages can also contain Windows features. You can also use these servicing commands to enable or disable Windows features, either offline or on a running Windows installation. Features are optional components for the core operating system.

The base syntax for servicing a Windows image using DISM is:

DISM.exe {/Image:<path_to_image_directory> | /Online} [dism_global_options] {servicing_option} [<servicing_argument>]

The following operating system package-servicing options are available for an offline image:

DISM.exe /Image:<path_to_image_directory> [/Get-Packages | /Get-PackageInfo | /Add-Package | /Remove-Package ] [/Get-Features | /Get-FeatureInfo | /Enable-Feature | /Disable-Feature ] [/Cleanup-Image]

The following operating system package-servicing options are available for a running operating system:

DISM.exe /Online [/Get-Packages | /Get-PackageInfo | /Add-Package | /Remove-Package ] [/Get-Features | /Get-FeatureInfo | /Enable-Feature | /Disable-Feature ] [/Cleanup-Image]

Operating system package-servicing options

This section describes how you can use each operating system package-servicing option. These options are not case sensitive. However, feature names are case sensitive if you are servicing a Windows image other than Windows® 8.

/Get-Help /?

When used immediately after a package-servicing command-line option, information about the option and the arguments is displayed.

Additional topics might become available when an image is specified.

Examples:

Dism /Image:C:\test\offline /Add-Package /?

Dism /Online /Get-Packages /?

/Get-Packages [/Format:{Table | List}]

Displays basic information about all packages in the image. Use the /Format:Table or /Format:List argument to display the output as a table or a list.

Examples:

Dism /Image:C:\test\offline /Get-Packages

Dism /Image:C:\test\offline /Get-Packages /Format:Table

Dism /Online /Get-Packages

/Get-PackageInfo {/PackageName:&lt; name_in_image&gt; | /PackagePath:&lt; path_to_cabfile&gt;}

Displays detailed information about a package provided as a .cab file. Only .cab files can be specified. You cannot use this command to obtain package information for .msu files. /PackagePath can point to either a .cab file or a folder.

You can use the /Get-Packages option to find the name of the package in the image, or you can specify the path to the .cab file. The path to the .cab file should point to the original source of the package, not to where the file is installed on the offline image.

Examples:

Dism /Image:C:\test\offline /Get-PackageInfo /PackagePath:C:\packages\package.cab

Dism /Image:C:\test\offline /Get-PackageInfo /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

/Add-Package /PackagePath:&lt; path_to_cabfile&gt; [/IgnoreCheck] [ /PreventPending]

Installs a specified .cab or .msu package in the image. Multiple packages can be added on one command line. The applicability of each package will be checked. If the package is cannot be applied to the specified image, you will receive an error message. Use the /IgnoreCheck argument if you want the command to process without checking the applicability of each package.

Use the /PreventPending option to skip the installation of the package if the package or Windows image has pending online actions. This option can only be used when servicing Windows 8, Windows Server 2012, or Windows® Preinstallation Environment (Windows PE) 4.0 images.

/PackagePath can point to:

  • A single .cab or .msu file.

  • A folder that contains a single expanded .cab file.

  • A folder that contains a single .msu file.

  • A folder that contains multiple .cab or .msu files.

Note

If /PackagePath points to a folder that contains a .cab or .msu files at its root, any subfolders will also be recursively checked for .cab and .msu files.

Examples:

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

Dism /Image:C:\test\offline /Add-Package /PackagePath:C:\packages\package1.cab /PackagePath:C:\packages\package2.cab /IgnoreCheck

Dism /Image:C:\test\offline /Add-Package /PackagePath:C:\test\packages\package.cab /PreventPending

/Remove-Package {/PackageName:&lt; name_in_image&gt; | /PackagePath:&lt; path_to_cabfile&gt;}

Removes a specified .cab file package from the image. Only .cab files can be specified. You cannot use this command to remove .msu files.

Note

Using this command to remove a package from an offline image will not reduce the image size.

You can use the /PackagePath option to point to the original source of the package, specify the path to the CAB file, or you can specify the package by name as it is listed in the image. Use the /Get-Packages option to find the name of the package in the image.

Examples:

Dism /Image:C:\test\offline /LogPath:C:\test\RemovePackage.log /Remove-Package /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

Dism /Image:C:\test\offline /LogPath:C:\test\RemovePackage.log /Remove-Package /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0 /PackageName:Microsoft-Windows-MediaPlayer-Package~31bf3856ad364e35~x86~~6.1.6801.0

Dism /Image:C:\test\offline /LogPath:C:\test\RemovePackage.log /Remove-Package /PackagePath:C:\packages\package1.cab /PackagePath:C:\packages\package2.cab

/Get-Features {/PackageName:&lt; name_in_image&gt; | /PackagePath:&lt; path_to_cabfile&gt;} [/Format:{Table | List}]

Displays basic information about all features (operating system components that include optional Windows foundation features) in a package. You can use the /Get-Features option to find the name of the package in the image, or you can specify the path to the original source of the package. If you do not specify a package name or path, all features in the image will be listed. /PackagePath can point to either a .cab file or a folder.

Feature names are case sensitive if you are servicing a Windows image other than Windows 8.

Use the /Format:Table or /Format:List argument to display the output as a table or a list.

Examples:

Dism /Image:C:\test\offline /Get-Features

Dism /Image:C:\test\offline /Get-Features /Format:List

Dism /Image:C:\test\offline /Get-Features /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

Dism /Image:C:\test\offline /Get-Features /PackagePath:C:\packages\package1.cab

/Get-FeatureInfo /FeatureName:&lt;name_in_image&gt;[{/PackageName:&lt; name_in_image&gt; | /PackagePath:&lt; path_to_cabfile&gt;}]

Displays detailed information about a feature. You must use /FeatureName. Feature names are case sensitive if you are servicing a Windows image other than Windows 8. You can use the /Get-Features option to find the name of the feature in the image.

/PackageName and /PackagePath are optional and can be used to find a specific feature in a package.

Examples:

Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts

Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts /PackagePath:C:\packages\package.cab

/Enable-Feature /FeatureName:&lt; name_in_image&gt;[/PackageName:&lt; name_in_image&gt;] [/Source: &lt;source&gt;] [/LimitAccess][/All]

Enables or updates the specified feature in the image. You must use the /FeatureName option. Feature names are case sensitive if you are servicing a Windows image other than Windows 8. Use the /Get-Features option to find the name of the feature in the image.

You can specify the /FeatureName option multiple times in one command line for features that share the same parent package.

You do not have to specify the package name using the /PackageName option if the package is a Windows Foundation Package. Otherwise, use /PackageName to specify the parent package of the feature.

You can restore and enable a feature that has previously been removed from the image. Use the /Source argument to specify the location of the files that are required to restore the feature. The source of the files can by the Windows folder in a mounted image, for example c:\test\mount\Windows. You can also use a Windows side-by-side folder as the source of the files, for example z:\sources\SxS.

If you specify multiple /Source arguments, the files are gathered from the first location where they are found and the rest of the locations are ignored. If you do not specify a /Source for a feature that has been removed, the default location in the registry is used or, for online images, Windows Update (WU) is used.

Use /LimitAccess to prevent DISM from contacting WU for online images.

Use /All to enable all parent features of the specified feature.

The /Source, /LimitAccess, and /All arguments can only be used when servicing Windows 8, Windows Server 2012, or Windows® Preinstallation Environment (Windows PE) 4.0 images.

Examples:

Dism /Online /Enable-Feature /FeatureName:Hearts /All

Dism /Online /Enable-Feature /FeatureName:Calc /Source:c:\test\mount\Windows /LimitAccess

Dism /Image:C:\test\offline /Enable-Feature /FeatureName:Calc /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

/Disable-Feature /FeatureName:&lt; name_in_image&gt; [/PackageName:&lt; name_in_image&gt;] [/Remove]

Disables the specified feature in the image. You must use the /FeatureName option. Feature names are case sensitive if you are servicing a Windows image other than Windows 8. Use the /Get-Features option to find the name of the feature in the image.

You can specify /FeatureName multiple times in one command line for features in the same parent package.

You do not have to specify the package name using the /PackageName option if it the package is a Windows Foundation Package. Otherwise, use /PackageName to specify the parent package of the feature.

Use /Remove to remove a feature without removing the feature's manifest from the image. This option can only be used when servicing Windows 8 or Windows Server 2012. The feature will be listed as "Removed" when you use /Get-FeatureInfo to display feature details and can be restored and enabled using /Enable-Feature with the /Source option.

Examples:

Dism /Online /Disable-Feature /FeatureName:Hearts

Dism /Image:C:\test\offline /Disable-Feature /FeatureName:Calc /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

/Cleanup-Image {/RevertPendingActions | /SPSuperseded [/HideSP] | /StartComponentCleanup [/ResetBase] | /AnalyzeComponentStore | /CheckHealth | /ScanHealth | /RestoreHealth [/Source: &lt;filepath&gt;] [/LimitAccess]}

Performs cleanup or recovery operations on the image.

If you experience a boot failure, you can use the /RevertPendingActions option to try to recover the system. The operation reverts all pending actions from the previous servicing operations because these actions might be the cause of the boot failure. The /RevertPendingActions option is not supported on a running operating system or a Windows PE or Windows Recovery Environment (Windows RE) image.

Important

You should use the /RevertPendingActions option only in a system-recovery scenario on a Windows image that did not boot.

Use /SPSuperseded to remove any backup files created during the installation of a service pack. Use /HideSP to prevent the service pack from being listed in the Installed Updates Control Panel.

Important

The service pack cannot be uninstalled after the /SPSuperseded operation is completed.

Use /StartComponentCleanup to clean up the superseded components and reduce the size of the component store. Use /ResetBase to reset the base of superseded components, which can further reduce the component store size.

Warning

Installed Windows updates can’t be uninstalled after running /StartComponentCleanup with the /ResetBase option.

Use /AnalyzeComponentStore to create a report of the component store. For more information about the report and how to use the information provided in the report, see https://go.microsoft.com/fwlink/?LinkId=293367.

Use /CheckHealth to check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired.

Use /ScanHealth to scan the image for component store corruption. This operation will take several minutes.

Use /RestoreHealth to scan the image for component store corruption, and then perform repair operations automatically. This operation will take several minutes.

Use /Source with /RestoreHealth to specify the location of known good versions of files that can be used for the repair, such as a path to the Windows directory of a mounted image.

If you specify multiple /Source arguments, the files are gathered from the first location where they are found and the rest of the locations are ignored. If you do not specify a /Source for a feature that has been removed, the default location in the registry is used or Windows Update (WU) is used for online images.

Use /LimitAccess to prevent DISM from contacting WU for repair of online images.

/AnalyzeComponentStore and /ResetBase can’t be used when servicing a version of Windows that is earlier than Windows 8.1 or Windows Server 2012 R2 images.

/StartComponentCleanup can’t be used when servicing a version of Windows that is earlier than Windows 8 or Windows Server 2012 images.

/CheckHealth, /ScanHealth, /RestoreHealth, /Source, and /LimitAccess can’t be used when servicing a version of Windows that is earlier than Windows 8 or Windows Server 2012 images.

/HideSP and /SPSuperseded can’t be used when servicing a version of Windows that is earlier than Windows® 7 Service Pack 1 (SP1) image.

Examples:

Dism /Image:C:\test\offline /Cleanup-Image /RevertPendingActions

Dism /Image:C:\test\offline /Cleanup-Image /SPSuperseded /HideSP

Dism /Online /Cleanup-Image /ScanHealth

Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess

Limitations

  • When you are installing a package in an offline image, the package state is “install pending” because of pending online actions. In other words, the package will be installed when the image is booted and the online actions are processed. If subsequent actions are requested, they cannot be processed until the previous pending online action is completed. You can use the /PreventPending option when you add a package with /AddPackage to skip the installation of a package when there are pending online actions.

  • Some packages require other packages to be installed first. You should not assume that dependencies will be satisfied. If there are dependency requirements, you should use an answer file to install the necessary packages. By passing an answer file to DISM, multiple packages can be installed in the correct order. This is the preferred method for installing multiple packages. For more information, see Add or Remove Packages Offline Using DISM.

  • Packages are installed in the order that they are listed in the command line.

  • When using DISM to list the optional components in a Windows PE image, the optional components will always be listed as pending even when the servicing operation was successful. This is by design and requires no additional action from you.

See Also

Reference

DISM Image Management Command-Line Options

Concepts

DISM Overview (Deployment Image Servicing and Management)

Other Resources

Deployment Image Servicing and Management (DISM) Command-Line Options