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

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

  • Use the /PreventPending option to skip the installation of the package if the package or Windows image has pending online actions.

Note

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

  • If you're adding a package with dependencies, make sure that all dependencies are installed when you add the package.
  • If you're adding an .msu, be sure to check the associated KB for any package-specific installation instructions.

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>}
  • Use /PackagePath to point to the original source of the package, specify the path to the CAB file, or to specify the package by name as it's 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

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}]
  • /Get-Features finds the name of the packages in the image, or in the original source of the package. If you don't specify a package name or path, all features in the image will be listed.
  • /PackageName is a package in an image. You can use /DISM Get-Packages to see the package names in an image.
  • /PackagePath can point to either a .cab file or a folder.

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.

  • Use /LimitAccess to prevent DISM from contacting WU for online images.
  • Use /All to enable all parent features of the specified feature.

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

  • 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 shouldn't assume that dependencies will be satisfied. If a package has dependency requirements, 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. 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.

What is DISM?

DISM Image Management Command-Line Options

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