DISM operations performed on a VHD cannot be discarded by using the /unmount option, as they can with .wim files. It is recommended that you create a backup copy of the .vhd file before servicing it.

Terms

attach

You can map the contents of a Windows 7 image in a VHD to a directory by attaching a vdisk using the Windows 7 DiskPart tool. Mapping the contents of an image to a directory is similar to mounting the image. The Attach vdisk command adds the .vhd file as a disk to the storage controller on the host.

offline

Offline servicing occurs when you modify or service a Windows® image entirely offline without booting it first.

vdisk

A virtual disk, as referred to in the DiskPart tool.

Step 1: Prepare an offline VHD

To prepare the VHD for servicing with the DISM tool, attach the vdisk using the DiskPart tool. At an elevated command prompt, type:

Add drivers

Multiple drivers can be also added with one set of commands, if you specify a folder instead of an .inf file. To install all the drivers in a folder and all its subfolders, use the /recurse option. For example, at the command prompt, type:

To install an unsigned driver, use the /ForceUnsigned option to override the requirement that drivers installed on X64-based computers must have a digital signature. For example, at the command prompt, type:

Removing a boot-critical driver package can make the offline Windows image unable to boot. In addition, you cannot remove in-box drivers, which are drivers that are installed on Windows by default. For more information, see Driver Servicing Command-Line Options.

Add a package or language pack

You can add multiple packages on one command line using the /Add-Package and /PackagePath options. For example, at the command prompt, type:

After you add or remove a language pack in a Windows image, you can set the default user-interface (UI) language, which is also known as the display language. At the same time, you can configure the international settings in the Windows image using DISM.

To change all international language settings in the mounted offline image to match the default values set by Microsoft for a given language, at the command prompt, type:

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.

Remove a package or language pack

Important

You should not remove a language pack from a mounted offline Windows image if there are pending online actions. To that end, the Windows image you are using should be a recently installed and captured image. This will ensure that the Windows image does not have any pending online actions that require a reboot.

Optional: Use the /Get-Intl command-line option to list the languages in the offline image:

After you add or remove a language pack in a Windows image, you can set the default user-interface (UI) language, which is also known as the display language. At the same time, you can configure the international settings in the Windows image using DISM.

To change all international language settings in the mounted offline image to match the default values set by Microsoft for a given language, at the command prompt, type:

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.

Add a local pack

Local packs provide region-specific customizations, such as Windows® Internet Explorer® Favorites and RSS feeds, for a Windows 7 installation. For more information, see Add and Remove Local Packs.

You can add multiple packages using the /Add-Package and /PackagePath options. For example, at the command prompt, type:

Before the content of a local pack will appear on a Windows installation, the location (GeoID) of the current user must be set to a location that matches the target location for that local pack. For more information, see Add and Remove Local Packs

The above commands are examples only. The build numbers will be different for your packages.

Before the content of a local pack will appear on a Windows installation, the location (GeoID) of the current user must be set to a location that matches the target location for that local pack. For more information, see Add and Remove Local Packs

Enable or disable a Windows feature

Optional: Use the /Get-Features option to list all the features available in the operating system. For example, at the command prompt, type:

Change the Windows image to a higher edition

Note which edition of Windows your image is currently set to. If the image has already been changed to a higher edition, you should not change it a second time. We recommend using the lowest edition as a starting point.

Use the /Get-TargetEditions option to find the editions of Windows that you can change your image to. For example, at a command prompt, type:

Use an answer file to service an offline VHD

For more information about creating an answer file for servicing offline images, including the components used to remove drivers, enumerate drivers and packages, and modify configuration settings, see the Service an Offline Image section of the documentation.

Use DISM to apply the unattended installation answer file to the Windows image on the attached vdisk. For example, at the command prompt, type: