Dela via


Service a Windows Vista or Server 2008 Image

Applies To: Windows 7, Windows Server 2008 R2

Note

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

In Windows Vista® with Service Pack 1 (SP1) and Windows Server® 2008, the Package Manager command-line tool was provided for updating Windows® images. In Windows® 7, Deployment Image Servicing and Management (DISM.exe) replaces Package Manager (pkgmgr.exe). DISM provides functional parity with Package Manager so that you can use it to update Windows Vista with Service Pack 2 (SP2), Windows Vista with SP1 and Windows Server 2008 images. However, you do not get the additional functionality that is provided in DISM and Windows 7. In effect, when you service a Windows Vista SP2 or SP1 image with DISM, the tool translates the DISM command to the equivalent Package Manager command so that the image can be updated. For more information, see How Deployment Image Servicing and Management Works.

Important

The Intlcfg.exe tool is deprecated in this release, but is still available for configuring international settings in Windows Vista® and Windows Server® 2008. For command line syntax, see Intlcfg Command-Line Options. For information about using Intlcfg.exe, see the Windows Vista SP1 release of the Windows OPK or Windows AIK.

This topic includes:

  • Supported DISM Command Options

  • Enable or Disable a Windows Feature Using DISM

  • Enable or Disable a Windows Feature Using DISM and an Answer File

  • Add or Remove Packages Using DISM

  • Add or Remove Packages Offline Using DISM and an Answer File

Supported DISM Command Options

The following DISM command options can be used to update a Windows Vista with SP2, Windows Vista with SP1 or Windows Server 2008 image offline.

DISM Command Option Package Manager Translation Description

/Get-Help

/?

/help

/h

/?

Important
Command-line Help is not available when you specify a Windows Vista with SP1 or Windows Server 2008 image for servicing. Help documentation is only available in the Windows Automated Installation Kit (Windows AIK) and the OEM Preinstallation Kit (OPK).

/Add-Package /PackagePath:<path_to_package_directory>

/ip /m:<path_to_package_directory>

Points to the directory that contains an expanded cabinet (.cab) file and installs the package in the image.

Example:

Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package1.cab /PackagePath:C:\packages\package2.cab

/Add-Package /PackageName:<name_in_image>

/ip /p:<name_in_image>

Installs one or more specified packages. The package name is case sensitive.

Example:

Dism /image:C:\test\offline /Add-Package /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0 /PackageName:Microsoft-Windows-MediaPlayer-Package~31bf3856ad364e35~x86~~6.1.6801.0

/Remove-Package /PackagePath:<path_to_package_directory>

/up /m:<path_to_package_directory >

Points to the original source of the package and removes the package from the image.

Example:

Dism /image:C:\test\offline /Remove-Package /PackagePath:C:\packages\package.cab

/Remove-Package /PackageName:<name_in_image>

/up /p:<package_name>

Removes one or more specified packages. The package name is case sensitive.

Example:

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

/PackageName:<name_in_image>

/p:<package_name>

Must be used when you add or remove a package to specify the name of the package. The package name is case sensitive.

/PackagePath:< path_to_package_directory>

/m:< path_to_package_directory>

Must be used to specify the location of the expanded cabinet (.cab) file when you add or remove a package.

/LogPath:<path_to_logfile.log>

l:<path_to_logfile.log>

Specifies the full path and file name to log to. The default logs are located at %WINDIR%\logs\cbs\cbs.log. The Setupact.log file is a full log, and the Setuperr.log file logs only errors. Logging does not work when installing from read-only media, such as a Windows PE CD.

Important

When servicing images with different architectures, you must specify different log file locations for each of the architectures.

Example:

Dism /image:C:\test\offline /LogPath:C:\dismlogs\x86vistasp1.log /Add-Package /PackagePath:C:\packages\package.cab 
Dism /image:C:\test\offline /LogPath:C:\dismlogs\x64vistasp1.log /Add-Package /PackagePath:C:\packages\package.cab

/Enable-Feature /FeatureName:<name_in_image>

/iu /p:<name_in_image>

Specifies one or more Windows features to enable. Feature names are case sensitive.

Example:

Dism /image:C:\test\offline /Enable-Feature /FeatureName:Hearts /FeatureName:Calc

/Disable-Feature /FeatureName:<name_in_image>

uu:<name_in_image>

Specifies one or more Windows features to disable. Feature names are case sensitive.

Example:

Dism /image:C:\test\offline /Disable-Feature /FeatureName:Hearts /FeatureName:Calc

/Apply-Unattend:<path_to_Unattended.xml>

n:<path_to_Unattended.xml>

Applies an Unattend.xml file to an image. If you are updating device drivers using an unattended answer file (Unattend.xml), you must apply the answer file to an image and specify the settings in the offlineServicing configuration pass.

Examples:

Dism /image:C:\test\offline /Apply-Unattend:C:\test\answerfiles\myunattend.xml
Dism /online /Apply-Unattend:C:\test\answerfiles\myunattend.xml

/NoRestart

/NoRestart

Suppresses reboot. If a reboot is not necessary, then this command does nothing. This option will keep the application from prompting for a restart (or keep it from restarting automatically if the /quiet option is used).

Example:

Dism /online /Add-Package /PackagePath:C:\packages\package.cab /NoRestart /quiet

/image:<path_to_mounted_image_directory> /WinDir:<path_to_windows_directory>

o:<path_to_mounted_image_directory>;<path_to_windows_directory>

This is the full path to the root directory of the mounted Windows image. If the Windows directory is not a subdirectory of the root directory, /WinDir must be specified.

Example:

Dism /image:C:\test\offline /WinDir:WinNT /Add-Package /PackagePath:C:\packages\package.cab

/quiet

/quiet

Turns off information and progress output to the console. Only error messages will be displayed. This option must be set every time the command line utility is run.

Example:

Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package.cab  /quiet

/ScratchDir:<path_to_scratch_directory>

s:<sandbox_directory>

Specifies a scratch directory to be used when extracting files for temporary use during servicing. The directory must exist locally. If not specified, the \Windows\Temp directory will be used.

Example:

Dism /image:C:\test\offline /ScratchDir:C:\Scratch  /Add-Package /PackagePath:C:\packages\package.cab 

Enable or Disable a Windows Feature Using DISM

  1. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to mount the offline Windows image you want to modify.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim  /index:1 /MountDir:C:\test\offline 
    

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

  2. Type the following command to enable a specific feature in the image.

    Dism /image:C:\test\offline /Enable-Feature /FeatureName:Hearts 
    
  3. You can type the following command to disable a specific feature in the image.

    Dism /image:C:\test\offline /Disable-Feature /FeatureName:Hearts 
    
  4. Type the following command to commit the changes and unmount the image.

    Dism /unmount-WIM /MountDir:C:\test\offline  /commit
    

Enable or Disable a Windows Feature Using DISM and an Answer File

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

  2. Expand the catalog in the Windows Image pane, and then expand Packages.

  3. Expand Foundation, and right-click Microsoft-Windows-Foundation-Package.

    You might need to expand an item to see all of its children. The parent must be enabled if any of its children are enabled.

  4. Click Add to Answer File.

  5. Click Enabled or Disabled next to the features that you intend to enable or disable. Click the arrow to select the opposite.

  6. Click Tools on the main menu, and click Validate Answer File.

  7. Correct any errors that appear in the Messages pane, and save the answer file.

  8. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to mount the offline Windows image.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim  /index:1  /MountDir:C:\test\offline 
    

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

  9. 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 
    
  10. At the 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 Using DISM

  1. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to mount the offline Windows image you want to modify.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim> /index:1  /MountDir:C:\test\offline 
    

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

  2. Type the following command to add a specific package to the image. Multiple packages can be added on one command line.

    Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package1.cab  /PackagePath:C:\packages\package2.cab 
    
  3. You can type the following command to remove a specific package from the image. Multiple packages can be removed 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 use the /PackageName option to specify the package by name as it is listed in the image. Use the /Get-Packages option to find the name of the package in the image. For more information, see Operating System Package Servicing Command-Line Options.

  4. 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 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 and click Open.

  3. To remove an existing package, select the package in the Answer file pane that you intend to remove. In the Properties pane, change the Action property to Remove.

Note

The packages must be added to the offlineServicing configuration pass.

  1. Validate and save the answer file.

  2. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to mount the offline Windows image.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim> /name:HomeBasic/MountDir:<path_to_mount_directory>
    

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

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

See Also

Concepts

Deployment Image Servicing and Management Technical Reference
How Deployment Image Servicing and Management Works
Service an Offline Image
Service an Online Image
Security Considerations
Best Practices for Servicing