次の方法で共有


Operating System Package Servicing 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.

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_options] {servicing_command} [<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 ]

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 ]

The following table provides a description of how each operating system package-servicing option can be used. These options are not case sensitive. However, feature names are case sensitive.

Option Argument Description

/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

/Format: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 get 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

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

/PackagePath can point to:

  • A single .cab or .msu file

  • A folder containing a single expanded .cab file

  • A folder containing a single .msu file

  • A folder containing multiple .cab or .msu files

Examples:

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

/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:RemovePackage.log /Remove-Package /PackagePath:C:\packages\package1.cab /PackagePath: C:\packages\package2.cab

/Get-Features

/PackageName:<name_in_image>

/PackagePath:<path_to_cabfile>

/Format:Table

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

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:<name_in_image>

/PackageName:<name_in_image>

/PackagePath:<path_to_cabfile>

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. Feature names are case sensitive.

/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:Feature /PackagePath:C:\packages\package.cab

/Enable-Feature

/FeatureName:<name_in_image>

/PackageName:<name_in_image>

/PackagePath: <path_to_package>

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. Feature names are case sensitive.

You do not need to specify the /PackageName if it is a Windows Foundation Package.

Use /PackagePath to point to the original source of the package. If the package is not already installed, it will be installed and enabled.

Examples:

Dism /image:C:\test\offline /Enable-Feature /FeatureName:Hearts
Dism /image:C:\test\offline /Enable-Feature /FeatureName:Calc /PackagePath:C:\packages\Calc.cab
Dism /image:C:\test\offline /Enable-Feature /FeatureName:Calc /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

/Disable-Feature

/FeatureName:<name_in_image>

/PackageName:<name_in_image>

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.

Feature names are case sensitive.

Examples:

Dism /image:C:\test\offline /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

Performs cleanup or recovery operations on the image.

If you experience a boot failure, you can use the /RevertPendingActions option to attempt a system recovery. 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 to perform recovery operations on a Windows image that failed to boot.

Examples:

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

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.

    If a package is in the “install pending” state, and then you stage the package, the package state is set to “uninstall pending”. This is because the package must be uninstalled before it can be staged.

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

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

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

See Also

Concepts

What Is Deployment Image Servicing and Management?
How Deployment Image Servicing and Management Works
Deployment Image Servicing and Management Command-Line Options
Windows PE Servicing Command-Line Options
Driver Servicing Command-Line Options
Languages and International Servicing Command-Line Options
Windows Edition-Servicing Command-Line Options