If you would like to read the first part in this article series please go to
- Deploying Windows 7 – Part 1: Windows AIK 2.0 Enhancements
- Deploying Windows 7 – Part 3: Understanding MAP 4.0
- Deploying Windows 7 – Part 4: Using MAP 4.0
- Deploying Windows 7 – Part 5: MDT 2010 Enhancements
- Deploying Windows 7 – Part 6: Lite Touch using MDT 2010
- Deploying Windows 7 – Part 7: Automated LTI Deployment
- Deploying Windows 7 – Part 8: Understanding LTI Configuration Files
- Deploying Windows 7 – Part 9: Deploying 32-bit vs. 64-bit Windows
- Deploying Windows 7 – Part 10: Capturing and Deploying an Image of a Reference Computer
- Deploying Windows 7 – Part 11: Capturing an Existing Installation
- Deploying Windows 7 – Part 12: Planning for Application Compatibility
- Deploying Windows 7 – Part 13: Manual Migration from Windows XP to Windows 7
- Deploying Windows 7 – Part 14: Automated Migration from Windows XP to Windows 7
- Deploying Windows 7 – Part 15: Configuring the MDT Database
- Deploying Windows 7 – Part 16: Using the MDT Database
- Deploying Windows 7 – Part 17: Deploying Applications Based on Make and Model
- Deploying Windows 7 – Part 18: Determining the UUID of a Computer
- Deploying Windows 7 – Part 19: Building a Custom WinPE Tools CD
- Deploying Windows 7 – Part 20: Securing MDT (Part 1)
- Deploying Windows 7 – Part 21: Securing MDT (Part 2)
- Deploying Windows 7 – Part 22: Bulk Populating the MDT Database Using PowerShell
- Deploying Windows 7 – Part 23: Managing Drivers – Introduction
- Deploying Windows 7 – Part 24: Managing Drivers – Issues and Approaches
- Deploying Windows 7 – Part 25: Managing Drivers – Selection Profiles
- Deploying Windows 7 – Part 26: Managing Drivers – By Make and Model
- Deploying Windows 7 – Part 27: Managing Drivers – Tips and Tricks
- Deploying Windows 7 – Part 28: Managing Software Updates
- Deploying Windows 7 – Part 29: Completing the LTI Deployment Infrastructure
Understanding DISM
DISM.exe is a new command-line tool that is included both in a default install of the Windows 7 operating system and also as part of version 2.0 of the Windows Automated Installation Kit (Windows AIK).
Note:
Support for VHD files as bootable Windows images is new in Windows 7 and is described in a later article of this series.
You can use DISM.exe service Windows images, including both Windows image (WIM) files and virtual hard disk (VHD) files. While DISM.exe is primarily intended for servicing offline (not running) Windows images, some of its functionality can also be utilized to service online (running) Windows operating systems. By servicing an image we mean doing things like adding or removing device drivers, adding or removing operating system packages, adding hotfixes, configuring international settings, and performing similar types of actions on the image. DISM can also be used to upgrade a Windows image to a different edition (for example, to upgrade from Business to Ultimate) and to prepare a Windows PE image for use.
You can use DISM.exe to service images of the following Windows versions:
- Windows Vista SP1 or later
- Windows Server 2008
- Windows 7
- Windows Server 2008 R2
Using DISM
In Windows Vista (or using the Windows AIK 1.1) servicing an image required using several different tools. For example, let us say you wanted to install an out-of-box device driver on an image you captured previously from a master installation. To do this in Vista, you had to:
- Mount the image using ImageX
- Add the device driver using Package Manager (Pkgmgr.exe)
- Unmount the image using ImageX
In addition, if your image was a Windows PE image then you also need to use the Windows Preinstallation Environment (PEimg.exe) tool to prepare the image. And finally, if you needed to modify the language and locate settings of the image, you had to use the International Settings Configuration Tool (Intlcfg.exe).
Beginning with Windows 7 however, DISM.exe now replaces the Pkgmgr.exe, Intlcfg.exe and PEimg.exe tools found in the earlier 1.1 version of the Windows AIK. In addition, DISM also includes functionality for mounting and unmounting images so you can service them.
A typical use for DISM might be to add a device driver to an offline Windows image prior to deploying the image onto hardware that requires that driver. Let’s walk through such a scenario to learn how to use DISM from the command-line.
First, in the C:\Images folder on our Windows AIK 2.0 technician computer is a Windows install image (install.wim file) for Windows 7:
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Images
Volume in drive C has no label.
Volume Serial Number is 1C9A-D699
Directory of C:\Images
05/03/2009 12:46 PM <DIR> .
05/03/2009 12:46 PM <DIR> ..
04/22/2009 07:28 AM 2,218,242,699 install.wim
1 File(s) 2,218,242,699 bytes
2 Dir(s) 180,411,486,208 bytes free
Note:
Remember from article 17 of my Deploying Vista series that there are two types of Windows images: boot and install images 🙂
Next, in the C:\Drivers folder are the Windows 7 beta drivers (version 2.91) for Microsoft LifeCam hardware:
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Drivers
Volume in drive C has no label.
Volume Serial Number is 1C9A-D699
Directory of C:\Drivers
05/03/2009 01:19 PM <DIR> .
05/03/2009 01:19 PM <DIR> ..
05/03/2009 01:19 PM <DIR> VX6000
0 File(s) 0 bytes
3 Dir(s) 180,411,486,208 bytes free
We will be mounting our image to an empty folder named C:\Servicing. Let’s begin by using the DISM.exe command with the /get-wiminfo parameter to display a list of all the Windows images contained in the install.wim file. Remember that an install image can contain more than one Windows image.
C:\Program Files\Windows AIK\Tools\PETools>dism /get-wiminfo /wimfile:C:\Images\install.wim
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Details for image : C:\Images\install.wim
Index : 1
Name : Windows 7 STARTER
Description : Windows 7 STARTER
Size : 7,927,317,234 bytes
Index : 2
Name : Windows 7 HOMEBASIC
Description : Windows 7 HOMEBASIC
Size : 7,983,232,406 bytes
Index : 3
Name : Windows 7 HOMEPREMIUM
Description : Windows 7 HOMEPREMIUM
Size : 8,422,988,972 bytes
Index : 4
Name : Windows 7 PROFESSIONAL
Description : Windows 7 PROFESSIONAL
Size : 8,303,245,818 bytes
Index : 5
Name : Windows 7 ULTIMATE
Description : Windows 7 ULTIMATE
Size : 8,461,373,562 bytes
The operation completed successfully.
Let us say that we are going to deploy Windows 7 Professional, in which case we can see from the above command output that the index number is 4 for this particular image. So, let us mount this particular Windows image to the empty C:\Servicing folder using the /mount-wim parameter of the DISM.exe command:
C:\Program Files\Windows AIK\Tools\PETools>dism /mount-wim /wimfile:C:\Images\install.wim /index:4 /mountdir:C:\Servicing
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Mounting image
[==========================100.0%==========================]
The operation completed successfully.
To verify whether the image has been mounted successfully we can use the /get-mountedinfo parameter like this:
C:\Program Files\Windows AIK\Tools\PETools>dism /get-mountedwiminfo
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Mounted images:
Mount Dir : C:\Servicing
Image File : C:\Images\install.wim
Image Index : 4
Mounted Read/Write : Yes
Status : Ok
The operation completed successfully.
If we examine the contents of the C:\Servicing directory, we can see the files and directories of our mounted image:
C:\Program Files\Windows AIK\Tools\PETools>dir C:\Servicing
Volume in drive C has no label.
Volume Serial Number is 1C9A-D699
Directory of C:\Servicing
04/22/2009 03:36 AM <DIR> .
04/22/2009 03:36 AM <DIR> ..
03/20/2009 10:42 AM 24 autoexec.bat
03/20/2009 10:42 AM 10 config.sys
04/22/2009 01:17 AM <DIR> PerfLogs
04/22/2009 05:26 AM <DIR> Program Files
04/22/2009 03:27 AM <DIR> Users
04/22/2009 05:29 AM <DIR> Windows
2 File(s) 34 bytes
6 Dir(s) 180,321,382,400 bytes free
Now let’s view what kinds of servicing actions we can perform on our mounted image:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /?
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Image Version: 6.1.7100.0
The following commands may be used to service the image:
WINDOWS EDITION SERVICING COMMANDS:
/Set-ProductKey – Populates the product key into the offline image.
/Get-TargetEditions – Displays a list of Windows editions that an image can be upgraded to.
/Get-CurrentEdition – Displays the editions of the specified image.
/Set-Edition – Upgrades the Windows image to a higher edition.
UNATTEND SERVICING COMMANDS:
/Apply-Unattend – Applies an unattend file to an image.
DRIVER SERVICING COMMANDS:
/Remove-Driver – Removes driver packages from an offline image.
/Add-Driver – Adds driver packages to an offline image.
/Get-DriverInfo – Displays information about a specific driver in an offline image or a running operating system.
/Get-Drivers – Displays information about all drivers in an offline image or a running operating system.
INTERNATIONAL SERVICING COMMANDS:
/Set-LayeredDriver – Sets keyboard layered driver.
/Set-UILang – Sets the default system UI language that is used in the mounted offline image.
/Set-UILangFallback – Sets the fallback default language for the system UI in the mounted offline image.
/Set-UserLocale – Sets the user locale in the mounted offline image.
/Set-SysLocale – Sets the language for non-Unicode programs (also called system locale) and font settings in the mounted offline image.
/Set-InputLocale – Sets the input locales and keyboard layouts to use in the mounted offline image.
/Set-TimeZone – Sets the default time zone in the mounted offline image.
/Set-AllIntl – Sets all international settings in the mounted offline image.
/Set-SKUIntlDefaults – Sets all international settings to the default values for the specified SKU language in the mounted offline image.
/Gen-LangIni – Generates a new lang.ini file.
/Set-SetupUILang – Defines the default language that will be used by setup.
/Get-Intl – Displays information about the international settings and languages.
APPLICATION SERVICING COMMANDS:
/Check-AppPatch – Displays information if the MSP patches are applicable to the mounted image.
/Get-AppPatchInfo – Displays information about installed MSP patches.
/Get-AppPatches – Displays information about all applied MSP patches for all installed applications.
/Get-AppInfo – Displays information about a specific installed MSI application.
/Get-Apps – Displays information about all installed MSI applications.
PACKAGE SERVICING COMMANDS:
/Add-Package – Adds packages to the image.
/Remove-Package – Removes packages from the image.
/Enable-Feature – Enables a specific feature in the image.
/Disable-Feature – Disables a specific feature in the image.
/Get-Packages – Displays information about all packages in the image.
/Get-PackageInfo – Displays information about a specific package.
/Get-Features – Displays information about all features in a package.
/Get-FeatureInfo – Displays information about a specific feature.
/Cleanup-Image – Performs cleanup and recovery operations on the image.
For more information about these servicing commands and their arguments,
specify a command immediately before /?.
Examples:
DISM.exe /Image:C:\test\offline /Apply-Unattend /?
DISM.exe /Image:C:\test\offline /Get-Features /?
DISM.exe /Online /Get-Drivers /?
The parameters we want to use are found under DRIVER SERVICING COMMANDS above. Let’s use the /get-drivers parameter to display a list of drivers already installed in the mounted image:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /get-drivers
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Image Version: 6.1.7100.0
Obtaining list of 3rd party drivers from the driver store…
Driver packages listing:
Published Name : oem0.inf
Original File Name : prnms001.inf
Inbox : No
Class Name : Printer
Provider Name : Microsoft
Date : 6/21/2006
Version : 6.1.7100.0
The operation completed successfully.
Let us now use the /add-driver parameter to add our LifeCam driver to the mounted image:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /add-driver /driver:C:\Drivers\VX6000\vx6000.inf
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Image Version: 6.1.7100.0
Found 1 driver package(s) to install.
Installing 1 of 1 – C:\Drivers\VX6000\vx6000.inf: The driver package was successfully installed.
The operation completed successfully.
Let’s use /get-drivers again to verify that the LifeCam driver has been successfully added to the mounted image:
C:\Program Files\Windows AIK\Tools\PETools>dism /image:C:\Servicing /get-drivers
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Image Version: 6.1.7100.0
Obtaining list of 3rd party drivers from the driver store…
Driver packages listing:
Published Name : oem0.inf
Original File Name : prnms001.inf
Inbox : No
Class Name : Printer
Provider Name : Microsoft
Date : 6/21/2006
Version : 6.1.7100.0
Published Name : oem1.inf
Original File Name : vx6000.inf
Inbox : No
Class Name : Image
Provider Name : Microsoft
Date : 7/18/2008
Version : 5.5.3.74
The operation completed successfully.
We now finish servicing the image by unmounting it:
C:\Program Files\Windows AIK\Tools\PETools>dism /unmount-wim /mountdir:C:\Servicing /commit
Deployment Image Servicing and Management tool
Version: 6.1.7100.0
Image File : C:\Images\install.wim
Image Index : 4
Saving image
[==========================100.0%==========================]
Unmounting image
[==========================100.0%==========================]
The operation completed successfully.
Additional Resources
For more information on using DISM.exe, type dism /? in the Deployment Tools Command Prompt on your technician computer. You can also find detailed information concerning DISM.exe in the Deployment Tools Technical Reference section of the Windows Automated Installation Kit User’s Guide (WAIK.chm) which can be accessed by clicking Start | All Programs | Microsoft Windows AIK on your technician computer.
Finally, check out the free e-learning Clinic 10077: What’s New in Windows 7 for IT Pros on the Windows 7 Learning Portal section of the Microsoft Learning web site. I was the one who developed the content for these three clinics, and the IT Pro clinic has a short video demonstration of using DISM to service an image by adding drivers to the image.
If you would like to read the first part in this article series please go to
- Deploying Windows 7 – Part 1: Windows AIK 2.0 Enhancements
- Deploying Windows 7 – Part 3: Understanding MAP 4.0
- Deploying Windows 7 – Part 4: Using MAP 4.0
- Deploying Windows 7 – Part 5: MDT 2010 Enhancements
- Deploying Windows 7 – Part 6: Lite Touch using MDT 2010
- Deploying Windows 7 – Part 7: Automated LTI Deployment
- Deploying Windows 7 – Part 8: Understanding LTI Configuration Files
- Deploying Windows 7 – Part 9: Deploying 32-bit vs. 64-bit Windows
- Deploying Windows 7 – Part 10: Capturing and Deploying an Image of a Reference Computer
- Deploying Windows 7 – Part 11: Capturing an Existing Installation
- Deploying Windows 7 – Part 12: Planning for Application Compatibility
- Deploying Windows 7 – Part 13: Manual Migration from Windows XP to Windows 7
- Deploying Windows 7 – Part 14: Automated Migration from Windows XP to Windows 7
- Deploying Windows 7 – Part 15: Configuring the MDT Database
- Deploying Windows 7 – Part 16: Using the MDT Database
- Deploying Windows 7 – Part 17: Deploying Applications Based on Make and Model
- Deploying Windows 7 – Part 18: Determining the UUID of a Computer
- Deploying Windows 7 – Part 19: Building a Custom WinPE Tools CD
- Deploying Windows 7 – Part 20: Securing MDT (Part 1)
- Deploying Windows 7 – Part 21: Securing MDT (Part 2)
- Deploying Windows 7 – Part 22: Bulk Populating the MDT Database Using PowerShell
- Deploying Windows 7 – Part 23: Managing Drivers – Introduction
- Deploying Windows 7 – Part 24: Managing Drivers – Issues and Approaches
- Deploying Windows 7 – Part 25: Managing Drivers – Selection Profiles
- Deploying Windows 7 – Part 26: Managing Drivers – By Make and Model
- Deploying Windows 7 – Part 27: Managing Drivers – Tips and Tricks
- Deploying Windows 7 – Part 28: Managing Software Updates
- Deploying Windows 7 – Part 29: Completing the LTI Deployment Infrastructure