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 /? |
|
||
/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:
|
||
/Add-Package /PackageName:<name_in_image> |
/ip /p:<name_in_image> |
Installs one or more specified packages. The package name is case sensitive. Example:
|
||
/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:
|
||
/Remove-Package /PackageName:<name_in_image> |
/up /p:<package_name> |
Removes one or more specified packages. The package name is case sensitive. Example:
|
||
/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:
|
||
/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:
|
||
/Disable-Feature /FeatureName:<name_in_image> |
uu:<name_in_image> |
Specifies one or more Windows features to disable. Feature names are case sensitive. Example:
|
||
/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:
|
||
/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:
|
||
/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:
|
||
/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:
|
||
/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:
|
Enable or Disable a Windows Feature Using DISM
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.
Type the following command to enable a specific feature in the image.
Dism /image:C:\test\offline /Enable-Feature /FeatureName:Hearts
You can type the following command to disable a specific feature in the image.
Dism /image:C:\test\offline /Disable-Feature /FeatureName:Hearts
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
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.
Expand the catalog in the Windows Image pane, and then expand Packages.
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.
Click Add to Answer File.
Click Enabled or Disabled next to the features that you intend to enable or disable. Click the arrow to select the opposite.
Click Tools on the main menu, and click Validate Answer File.
Correct any errors that appear in the Messages pane, and save the answer file.
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.
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
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
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.
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
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.
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
Open Windows SIM.
To add a new package, click Insert on the main menu, and select Package(s). Browse to the package and click Open.
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.
Validate and save the answer file.
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.
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
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