DISM Operating System Package (.cab or .msu) Servicing Command-Line Options (original) (raw)

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

DISM Operating System Package (.cab or .msu) Servicing Command-Line Options

In this article

Use DISM with Windows cabinet (.cab) or Windows Update Stand-alone Installer (.msu) files to install or remove updates, language packs, and to enable or disable Windows features. Features are optional components for the core operating system.

Syntax

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]

/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.

Syntax:

Dism /Get-Help 

Examples:

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

/Get-Packages

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.

Syntax:

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

Examples:

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

/Get-PackageInfo

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:<path_to_package> 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.

Syntax:

Dism /Get-PackageInfo {/PackageName:<name_in_image> | /PackagePath:<path_to_cabfile>}

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

Installs a specified .cab or .msu package in the image.

Note

You can use /Add-Package to add an .msu package to an online or offline Windows 11, version 21H2, or later image. If you're working with a Windows image prior to Windows 11, version 21H2, you can only add .msu packages on offline target images.

Multiple packages can be added on one command line. The applicability of each package will be checked. If the package 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.

Syntax:

Dism /Add-Package /PackagePath:<path_to_cabfile> [/IgnoreCheck] [/PreventPending]

Note

/Add-Package doesn't run a full check for a package's applicability and dependencies:

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

Checkpoint cumulative updates

Starting with Windows 11, version 24H2, the latest cumulative update may have a prerequisite cumulative update that is required to be installed first. To install these checkpoint cumulative updates, call /Add-Package with the target cumulative update. The folder from -PackagePath will be used to discover and install one or more checkpoints as needed. Only the target cumulative update and any prerequisite checkpoint cumulative updates should be in the -PackagePath folder. Cumulative update packages with a revision less than or equal to the target cumulative update will be processed.

/Remove-Package

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.

Syntax:

/Remove-Package {/PackageName:<name_in_image> | /PackagePath:<path_to_cabfile>}

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

Displays basic information about all features (operating system components that include optional Windows foundation features) in a package.

Syntax:

/Get-Features {/PackageName:<name_in_image> | /PackagePath:<path_to_cabfile>} [/Format:{Table | List}]

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

Displays detailed information about a feature. You must use /FeatureName. You can use the /Get-Features option to find the name of the feature in the image.

Syntax:

/Get-FeatureInfo /FeatureName:<name_in_image> [{/PackageName:<name_in_image> | /PackagePath:<path_to_cabfile>}]

/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

Enables or updates the specified feature in the image. You must use the /FeatureName option. Use the /Get-Features option to find the name of the feature in the image.

Syntax:

/Enable-Feature /FeatureName:<name_in_image> [/PackageName:<name_in_image>] [/Source: <source>] [/LimitAccess] [/All]

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

You don't 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.

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

Disables the specified feature in the image. You must use the /FeatureName option. Use the /Get-Features option to find the name of the feature in the image.

Syntax:

/Disable-Feature /FeatureName:<name_in_image> [/PackageName:<name_in_image>] [/Remove]

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. 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

Performs cleanup or recovery operations on the image. /AnalyzeComponentStore and /ResetBase can be used with Windows 10, Windows 8.1, and Windows PE images above 5.0. Beginning with Windows 10, version 1607, you can specify /Defer with /ResetBase, but you should only use /Defer as an option in the factory where DISM /Resetbase requires more than 30 minutes to complete.

Tip

To determine when the /ResetBase option was last run, check the LastResetBase_UTC registry entry under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing registry path.

Syntax:

/Cleanup-Image {/RevertPendingActions | /SPSuperseded [/HideSP] | /StartComponentCleanup [/ResetBase [/Defer]] | /AnalyzeComponentStore | /CheckHealth | /ScanHealth | /RestoreHealth [/Source: <filepath>] [/LimitAccess]}
Parameter Description
/RevertPendingActions 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.
SPSuperseded Removes 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. The service pack cannot be uninstalled after the /SPSuperseded operation is completed.
/StartComponentCleanup Cleans up the superseded components and reduces the size of the component store. Use /ResetBase to reset the base of superseded components, which can further reduce the component store size. Installed Windows updates can’t be uninstalled after running /StartComponentCleanup with the /ResetBase option. Use /Defer with /ResetBase to defer long-running cleanup operations to the next automatic maintenance.
/AnalyzeComponentStore Creates a report of the component store. For more information about the report and how to use the information provided in the report, see Determine the Actual Size of the WinSxS Folder.
/CheckHealth Checks whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired.
/ScanHealth Scans the image for component store corruption. This operation will take several minutes.
/RestoreHealth Scans the image for component store corruption, and then performs repair operations automatically. This operation will take several minutes.
/Source Used 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.
/LimitAccess Prevents DISM from contacting Windows Update for repair of online images.

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

To learn more, see Repair a Windows Image.

Limitations

What is DISM?

DISM Image Management Command-Line Options

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

Additional resources

In this article