Service a Mounted Windows Image
Updated: October 20, 2013
Applies To: Windows 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2
You can use the Deployment Image Servicing and Management (DISM) tool to mount a Windows image from a WIM or VHD file and modify it. In the first part of this walkthrough, you add a language pack, configuring international settings and enable 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 that has the Windows ADK tools installed on it.
A .wim, .vhd, or .vhdx file to update.
Language packs, or other packages to add and remove from the image.
In this step, you mount a Windows image to a specified directory, so that it is available for servicing.
Copy a .wim file, a .vhd, or a .vhdx that contains a Windows image, to the local drive. For example, C:\test\images.
Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.
Create a folder for your mounted image. For example, C:\test\offline.
Run the DISM /Get-ImageInfo command to retrieve the name or index number for the image that you want to update. For example:
Dism /Get-ImageInfo /ImageFile:C:\test\images\MyImage.wim
Mount the Windows image. For example:
Dism /Mount-Image /ImageFile:C:\test\images\MyImage.wim /Index:1 /MountDir:C:\test\offline
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 /Image:C:\test\offline /Set-SKUIntlDefaults:fr-FR
At the command prompt, commit the changes. The image remains mounted until the /Unmount-Image option is used. For example:
Dism /Commit-Image /MountDir:C:\test\offline
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
>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
All of the changes that you make are also applied to each potential target edition of Windows. Each target edition is staged in the image. The changes will not be lost when you upgrade to a higher edition of Windows. For more information, see DISM 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
At the command prompt, specify the edition that you want 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.
This walkthrough illustrates the 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 image file to the local hard disk drive, you can delete the original image 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 additional offline servicing operations that can be performed on an offline image, see DISM Image Management Command-Line Options.