DISM Operating System Package Servicing Command-Line Options


Updated: October 20, 2013
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:< name_in_image> | /PackagePath:< path_to_cabfile>}


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:< path_to_cabfile> [/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:< name_in_image> | /PackagePath:< path_to_cabfile>}

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


© 2014 Microsoft

Full article from Microsoft TechNet - DISM Operating System Package Servicing Command-Line Options