- DISM Operating System Package (.cab or .msu) Servicing Command-Line Options
- Syntax
- Operating system package-servicing options
- /Get-Help /?
- /Get-Packages
- /Get-PackageInfo
- /Add-Package
- /Remove-Package
- /Get-Features
- /Get-FeatureInfo
- /Enable-Feature
- /Disable-Feature
- /Cleanup-Image
- Enable or Disable Windows Features Using DISM
- To mount an offline image for servicing
- To find available Windows features in an image
- To enable Windows features
- To restore removed Windows features
- To disable Windows features
- To remove Windows features for on-demand installation
- To enable or disable Windows features by using DISM and an answer file
- To commit changes on an offline image
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, service packs, language packs, and to enable or disable Windows features. Features are optional components for the core operating system.
Syntax
The following operating system package-servicing options are available for an offline image:
The following operating system package-servicing options are available for a running operating system:
Operating system package-servicing options
This section describes how you can use each operating system package-servicing option. These options are not case sensitive.
/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.
/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.
/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 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.
/Add-Package
Installs a specified .cab or .msu package in the image. An .msu package is supported only when the target image is offline, either mounted or applied.
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.
Use the /PreventPending option to skip the installation of the package if the package or Windows image has pending online actions. (Introduced in Windows 8/WindowsВ PEВ 4.0).
/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.
NotesВ В
- 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.
- /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.
/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.
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.
/Get-Features
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.
/Get-FeatureInfo
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В 10 or Windows 8.x. 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.
/Enable-Feature
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 be used with WindowsВ 10, WindowsВ 8.x, and WindowsВ PEВ images above 4.0.
/Disable-Feature
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 can be used with WindowsВ 10, WindowsВ 8.x, and WindowsВ PEВ images above 4.0. 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.
/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 we highly recommend you only use /Defer as an option in the factory where DISM /Resetbase requires more than 30 minutes to complete. /StartComponentCleanup can be used with Windows 10, Windows 8.x, and Windows PE images above 4.0. /CheckHealth, /ScanHealth, /RestoreHealth, /Source, and /LimitAccess can be used with Windows 10, Windows 8.x, and Windows PE images above 4.0. /HideSP and /SPSuperseded can’t be used when servicing a version of Windows that is earlier than Windows 7 Service Pack 1 (SP1) image.
TipВ В To determine when the /ResetBase option was last run, check the LastResetBase_UTC registry entry under this registry path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing
Enable or Disable Windows Features Using DISM
The Deployment Image Servicing and Management (DISM) tool is a command-line tool that is used to modify WindowsВ® images. You can use DISM to enable or disable Windows features directly from the command prompt, or by applying an answer file to the image. You can enable or disable Windows features offline on a WIM or VHD file, or online on a running operating system.
To mount an offline image for servicing
Open a command prompt with administrator privileges.
To use DISM from an installation of the Windows Assessment and Deployment Kit (WindowsВ ADK), locate the WindowsВ ADK servicing folder and navigate to this directory. By default, DISM is installed at C:\Program Files (x86)\Windows Kits\10.0\Assessment and Deployment Kit\Deployment Tools\ in WindowsВ 10, C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\ in WindowsВ 8.1and C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\ in WindowsВ 8.
DISM is available in:
- WindowsВ 10
- WindowsВ 8.1
- WindowsВ 8
- Windows ServerВ 2016 Technical Preview
- WindowsВ Server 2012 R2
- Windows ServerВ 2012
- Windows Preinstallation Environment (WinPE) for WindowsВ 10
- WinPE 5.0
- WinPEВ 4.0
You can install DISM and other deployment and imaging tools, such as Windows System Image Manager (WindowsВ SIM), on another supported operating system from the WindowsВ ADK. For more information, see DISM Supported Platforms.
Use the /Get-ImageInfo option to retrieve the name or index number for the image that you want to modify. An index or name value is required for most operations that specify an image file.
For example, at the command prompt type:
Mount the offline Windows image. For example, type:
To find available Windows features in an image
List all of the features available in the operating system. For example, type:
To service an offline image, specify the location of the mounted image directory. For example, type:
You can use >featurelist.txt to redirect the output of the command to a text file that is named featurelist.
Review the list of features to find the feature that you want to enable, disable, remove, or restore.
Use /Get-FeatureInfo to list information about the specific feature you are interested in. For example, type:
To enable Windows features
Enable a specific feature in the image. You can use the /All argument to enable all of the parent features in the same command. For example, type:
To service an offline image, specify the location of the mounted image directory. For example, type:
Optional: Get the status of the feature you have enabled. For example, type:
If the status is Enble Pending, you must boot the image in order to enable the feature entirely.
To restore removed Windows features
Enable a specific feature in the image. If you do not specify a source, DISM will look in the default location specified by group policy for the required files needed to enable the feature For more information, see Configure a Windows Repair Source.
If the files are not found in the default location, DISM will contact Windows Update (WU) for the required files. You can use the /LimitAccess argument to prevent DISM from contacting WU.
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.
For example, type:
To service an offline image, specify the location of the mounted image directory. For example, type:
Optional: Get the status of the feature you have enabled. For example, type:
If the status is EnablePending, you must boot the image in order to enable the feature entirely.
To disable Windows features
Disable a specific feature in the image. For example, type:
To service an offline image, specify the location of the mounted image directory. For example, type:
Optional: Use DISM /GetFeatureInfo to get the status of the feature you have disabled. For example, type:
If the status is DisablePending, you must boot the image in order to disable the feature entirely.
To remove Windows features for on-demand installation
Remove a specific feature in the image without removing the feature’s manifest from the image. This option can only be used when servicing WindowsВ 10, WindowsВ 8.1, WindowsВ 8, Windows ServerВ 2016 Technical Preview, WindowsВ Server 2012 R2, or Windows ServerВ 2012. For more information, see Configure a Windows Repair Source.
For example, type:
To service an offline image, specify the location of the mounted image directory. For example, type:
Optional: Use DISM /GetFeatureInfo to get the status of the feature you have disabled. For example, type:
The status is Disabled. Beginning with Windows 10, the payload is not removed from Windows client SKUs in order to support push-button reset. The payload is removed from Windows Server SKUs.
To enable or disable Windows features by using DISM and an answer file
In WindowsВ SIM, open an existing catalog by clicking Select a Windows Image on the File menu and specifying the catalog file type (.clg) in the drop-down list, or create a new catalog by clicking Create Catalog on the Tools menu.
Expand the catalog in the Windows Image pane, and then expand Packages.
Expand Foundation, and right-click Microsoft-Windows-Foundation-Package.
Click Add to Answer File.
Click Enabled or Disabled next to the features that you intend to enable or disable. Click the arrow to select the opposite choice.
You might have to expand an item to see all its children. You must enable the parent if any one of its children are enabled.
NoteВ В You can’t restore or remove a Windows feature for features on demand with an unattended answer file.
Click Tools on the main menu, and then click Validate Answer File.
Correct any errors that appear in the Messages pane, and save the answer file.
At the command prompt, type the following command to apply the unattended answer file to the image.
To service an offline image, specify the location of the mounted image directory. For example, type:
To commit changes on an offline image
Commit the changes and unmount the image. For example, type: