Deployment Image Servicing and Management (DISM.exe) is a command-line tool used to update offline Windows® images. There are two ways to install or remove packages offline with DISM. You can either apply an unattend answer file to the offline image, or you can add or remove the package directly from the command prompt.
If you are installing multiple packages to a Windows image, and there are dependency requirements, the best way to ensure the correct order of the installation is by using an answer file. You can use DISM to apply the Unattend.xml answer file to the image. When you use DISM to apply an answer file, the unattend settings in the offlineServicing configuration pass are applied to the Windows image.
You must install the latest version of the Windows OEM Preinstallation Kit (Windows OPK), which contains all of the tools required, including DISM.
Add Packages to an Offline Image 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
- At a command prompt, type the following command to add a
specific package to the image. You can add multiple packages on one
command line. They will be installed in the order listed in the
command line.
Dism /Image:C:\test\offline /Add-Package /PackagePath:C:\packages\package1.cab /PackagePath:C:\packages\package2.cab
- At a command prompt, type the following command to commit the
changes and unmount the image.
Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
Remove Packages from an Offline Image 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: Type the following command to list the packages in
the image.
Dism /Image:C:\test\offline /Get-Packages
>featurelist.txt
to output the list to a text file named FeatureList.
- Review the list of packages that are available in your mounted
image and note the package identity of the package.
- At a command prompt, specify the package identity to remove it
from the image. You can remove multiple packages on one command
line.
DISM /Image:C:\test\offline /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
- At a command prompt, type the following command to commit the
changes and unmount the image.
Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
Add or Remove Packages Offline by Using DISM and an Answer File
- Open Windows SIM.
- To add a new package, click Insert on the main menu, and
select Package(s). Browse to the package you want to add,
and click Open.
- To remove an existing package, select the package in the
Answer file pane that you want to remove. In the
Properties pane, change the Action property to
Remove.
Note: The packages must be added to the offlineServicing configuration pass.
- Validate and save the answer file.
- At an elevated command prompt, navigate to the OPK servicing
folder, and then 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 a 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 a 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.