DISM is a command-line tool used to update offline Windows® images. There are two ways to enable or disable features offline with Deployment Image Servicing and Management (DISM.exe). You can either apply an unattend answer file to the offline image, or you can enable or disable features directly from the command prompt.
You must install the latest version of the Windows OEM Preinstallation Kit (Windows OPK), which contains all of the tools required, including Windows System Image Manager (Windows SIM) and DISM.
To enable Windows features offline by using DISM
- At an elevated command prompt, navigate to the OPK servicing
folder, and type the following command to retrieve the name or
index number for the image you want to modify.
Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
- Type the following command to mount the offline Windows
image.
Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline>
- Optional: At the command prompt, type the following command to
list all of the features available in the operating system.
Dism /Image:C:\test\offline /Get-Features
>featurelist.txt
to output the list to a text file named FeatureList.
- Review the list of features to find the feature that you want
to enable.
- Optional: At the command prompt, type the following command to
list information about the specific feature you are interested
in.
Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts
- Type the following command to enable a specific feature in the
image.
Dism /Image:C:\test\offline /Enable-Feature /FeatureName:Hearts
- Type the following command to commit the changes and unmount
the image.
Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
To disable Windows features offline by using DISM
- At an elevated command prompt, navigate to the OPK servicing
folder, and type the following command to retrieve the name or
index number for the image you want to modify.
Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
- Type the following command to mount the offline Windows
image.
Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline
- Optional: At the command prompt, type the following command to
list all of the features available in the operating system.
Dism /Image:C:\test\offline /Get-Features
- Review the list of features to find the feature that you want
to disable.
- Optional: At the command prompt, type the following command to
list information about the specific feature you are interested
in.
Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts
- Type the following command to disable a specific feature in the
image.
Dism /Image:C:\test\offline /Disable-Feature /FeatureName:Hearts
- Type the following command to commit the changes and unmount
the image.
Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
To enable or disable Windows features offline by using DISM and an answer file
- In Windows SIM, open an existing catalog by right-clicking
Select a Windows Image or Catalog file 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 need to expand an item to see all of its children. You must enable the parent if any of its children are enabled.
- Click Tools on the main menu, and click Validate
Answer File.
- Correct any errors that appear in the Messages pane, and
save the answer file.
- At an elevated command prompt, navigate to the OPK servicing
folder, and type the following command to retrieve the name or
index number for the image you want to mount.
Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
- Type the following command to mount the offline Windows
image.
Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline
- At the command prompt, type the following command to apply the
unattended answer file to the image.
DISM /Image:C:\test\offline /Apply-Unattend:C:\test\answerfiles\myunattend.xml
- At the command prompt, type the following command to commit the
changes and unmount the image.
Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
For more information about Windows SIM, see Windows Setup Technical Reference.