Add or Remove Packages Offline

In this article

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

An index or name value is required for most operations that specify a Windows imaging (WIM) file.

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.

You can use the /PackagePath option to point to the original source of the package, or to specify the path to the .cab file, or you can use the /PackageName option to specify the package by name as it is listed in the image. For more information, see Operating System Package Servicing Command-Line Options

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.