Service a Mounted Windows Image
Applies To: Windows 7, Windows Server 2008 R2
This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.
In Windows® 7, you can modify a Windows image (.wim) file offline by using the Deployment Image Servicing and Management (DISM) tool without recapturing the image or by using an unattended answer file. This walkthrough describes how to use DISM to mount an image and modify it.
DISM is a command-line tool that is installed with Windows 7. It is also distributed in the Windows OEM Preinstallation Kit (Windows OPK) and the Windows Automated Installation Kit (Windows AIK). DISM installs, uninstalls, configures, and enables features and packages in offline Windows images and offline Windows Preinstallation Environment (Windows PE) images.
In the first part of the process, you add a language pack, configuring international settings and enabling Windows features. In the second part, you remove a package, and then upgrade the Windows image to a higher edition of Windows.
To complete the walkthrough, you need the following:
A computer with the Windows OPK or Windows AIK tool installed on it.
A Windows 7 .wim file to update.
Language packs, or other packages to add and remove from the image.
Step 1: Mount an Image with Read/Write Permissions
In this step, you mount a Windows image to a specified directory, so that it is available for servicing.
Copy a .wim file to your local drive. For example, C:\test\images.
Click Start, point to All Programs, point to Windows OPK, right-click Deployment Tools Command Prompt, and then select Run as administrator.
Create a folder for your mounted image. For example, C:\test\offline.
Run the DISM /Get-WimInfo command to retrieve the name or index number for the image you want to update. For example:
Dism /Get-WimInfo /WimFile:C:\test\images\MyImage.wim
Mount the Windows image. For example:
Dism /Mount-Wim /WimFile:C:\test\images\MyImage.wim /index:1 /MountDir:C:\test\offline
Since .wim files can contain one or more images, you must specify an index or name value.
Step 2: Add Packages to the Image
In this step, you add packages to the mounted Windows image.
At an elevated command prompt, add packages to the mounted Windows image. For example:
Dism /image:C:\test\offline /Add-Package /PackagePath:C:\test\packages\package1.cab /PackagePath:C:\test\packages\package2.cab
If you added a language pack, you can change all international language settings in the mounted offline image by typing the following command:
DISM.exe /image:C:\test\offline /Set-SKUIntlDefaults:fr-FR
Optionally, you can configure different values for different settings, including UI language, system locale, user locale, input locale, and others. For more information about specifying individual values for each of these settings, see Languages and International Servicing Command-Line Options.
At the command prompt, commit the changes. The image remains mounted until the /unmount option is used. For example:
Dism /Commit-Wim /MountDir:C:\test\offline
Step 3: Remove a Package from the Mounted Image
In this step, you review the packages that have been installed in your image, and then remove a specific package from the image.
At an elevated command prompt, find the names of the packages that are in your image. For example:
Dism /image:C:\test\offline /Get-Packages
If the list of packages is extensive, you can output the information to a text file. For example, you can add
>C:\PackageList.txtto the end of the command line.
Review the list of packages that are available in your mounted image, and note the package identity of the package.
At a command prompt, specify the package identity of a package and remove it from the mounted image. For example:
Dism /image:C:\test\offline /Remove-Package /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~184.108.40.206
Step 4: Upgrade to a Higher Edition of Windows
If you are using the Home Basic edition of Windows 7, all of the changes that you make are also applied to each potential target edition of Windows. Each target edition is staged within the Windows 7 image. The changes will not be lost when you upgrade to a higher edition of Windows. For more information, see Windows Edition-Servicing Command-Line Options.
At an elevated command prompt, list the editions that are available for the upgrade. For example:
Dism /image:C:\test\offline /Get-TargetEditions
Note the target edition ID.
At the command prompt, specify the edition that you would like to upgrade to. For example:
Dism /image:C:\test\offline /Set-Edition:Ultimate
End users can use Windows Anytime Upgrade to remove files related to lower editions of Windows that are not being used.
Step 5: Commit the Changes and Unmount the Image
In this step, you unmount the image and save the changes that you have made.
At an elevated command prompt, unmount the image and commit the changes to the .wim file. For example:
Dism /unmount-WIM /MountDir:C:\test\offline /commit
This walkthrough illustrates basic offline servicing of a mounted Windows image. All the changes were made to a single image, and persisted when the image was upgraded. The updated image is ready to be deployed. Because you copied the .wim file to the local hard drive, you can delete the original .wim file from the server. You can replace it with this new one, or keep a copy of the older version for reference.
For more information about various deployment options, see Phase 4: Deploying Your Windows Image. For more information about additional offline servicing operations that can be performed on an offline image, see Deployment Image Servicing and Management Command-Line Options.