Deployment Image Servicing and Management (DISM.exe) is a command-line tool that is used to update offline Windows Image. There are two ways to install or remove packages offline with DISM. You can either apply an unattended answer file to the offline image, or you can add or remove the package directly from the command prompt using DISM or PowerShell.
Note: If you would like to install multiple packages to a Windows image with 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 unattended settings in the offline servicing configuration pass are applied to the Windows image.
To ensure we are able to add packages to the Windows image, we must install the latest version of the Windows Assessment and Deployment Kit (Windows ADK), which contains all of the tools that are required, including DISM. Here are some possible errors you can encounter while resolving this issue Error 0xc1570103: The license file was not found in the specified path , and how to fix error 0xc1510114: The wim file needs to be remounted.
Below are the steps needed to add packages to an install.wim file (windows image).
1: Ensure the image is mounted. See this article on how to mount an image.
2: After the images are mounted, you can remove packages that are not required by your organization. See this link on how to remove packages from the Windows image.
Now that we have successfully cleaned out wim file, we can then proceed to add the packages. Before you proceed, you may want to view the packages that are already installed. In this guide, you will learn how to add packages to an install.wim image.
Using DISM: It makes sense to query the Windows image to get the pre-installed apps and this can be achieved using the command below.
dism /Image:G:\MountZ /Get-Package
Add your desired packages: With the command above, we can review the package we need and then add them with the command below. Here is how to add LXPs to Windows image using DISM and PowerShell.
dism /Image:G:\Path-to-the-mounted-wim-file\<MountedZ(mountedDirectory)> /Add-Package /PackagePath:G:\path-to-the-package\the-cabinet(cab)-file-to-be-added
After successfully adding the package to the WIM file, you should get a message as shown below
Deployment Image Servicing and Management tool
Image Version: xxxxxxxxxxxxxxx
Processing 1 of 1 - Adding package Microsoft-Windows-TabletPCMath-Package~31bf3856ad364e35~amd64~~.cab [==========================100.0%==========================] The operation completed successfully.
Now that the packages have been added successfully, you will have to save (commit) the changes made to the wim file as shown below. This will unmount and save the newest state. For more on these commands, see the Microsoft documentation.
dism /unmount-wim /mountdir:G:\Path-to-the-mount-file\MountZ /commit
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.