Export (0) Print
Expand All
4 out of 9 rated this helpful - Rate this topic

Add or Remove Packages Offline

Published: October 22, 2009

Updated: October 22, 2009

Applies To: Windows 7, Windows Server 2008 R2

noteNote
This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

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

  1. 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.

  2. 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
    
  3. 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
    
  4. 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

  1. 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 WIM file.

  2. 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
    
  3. Optional: Type the following command to list the packages in the image.

    Dism /Image:C:\test\offline /Get-Packages
    
    You can use >featurelist.txt to output the list to a text file named FeatureList.

  4. Review the list of packages that are available in your mounted image and note the package identity of the package.

  5. 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
    
    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

  6. 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

  1. Open Windows SIM.

  2. 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.

  3. 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.

    noteNote
    The packages must be added to the offlineServicing configuration pass.

  4. Validate and save the answer file.

  5. 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
    
  6. 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
    
    An index or name value is required for most operations that specify a WIM file.

  7. 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
    
  8. 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.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.