Although image management is an important task for desktop deployments, I have always felt that Microsoft's image management tools for Windows Vista were lacking.
Unless you bought third-party software, there was no single image management tool for managing Vista images. While Microsoft offered the Automated Installation Kit, but it was made up of several different tools, many that had to be used together to perform even the simplest image management tasks.
The Deployment Image Servicing and Management tool in Windows 7 addresses this capability.
For example, suppose you want to add a device driver to a Windows Vista deployment image. You would have to use ImageX to mount the image and then use Package Manager to inject the device driver into the image. Even then, you wouldn't be able to perform full device driver management. While you could add a device driver to an image, there were no provisions for removing an unwanted device driver.
In Windows 7, Microsoft has rolled all of the functionality found in the individual Windows Automated Installation Kit tools -- PEimg.exe, intlcfg.exe, pkgmgr.exe and ImageX -- into Deployment Image Servicing and Management (DISM).
Now, you can use a single command-line tool to service Windows installation images. In addition, DISM provides functionality that did not exist in Version 1.1 of the Windows Automated Installation Kit.
The best known new feature is the ability to manage virtual hard drive (.VHD) files using the same set of commands used to manage traditional Windows Image (.WIM) files.
DISM has so many features that I can't possibly talk about all of them within the confines of one article. I do, however, want to give you a tour of a few of the new features.
The first thing that to do is mount the .WIM or .VHD file that you want to work with. In Vista, this was done using ImageX, but DISM can now be used for this task. To mount an image, use the /mount-wim switch, and then use the /WimFile switch to specify the name of the file. For example, Figure 1 shows what it looks like when a boot image is mounted.
Another nice new feature is DISM lets you perform enumeration on an image file to find out what packages are stored in the image. These packages can be language packs, utilities, patches, etc.
To access a list of the packages that are installed, simply enter the following command:
For example, if you look back at Figure 1, you will notice that we used a switch called
/MountDir and followed it with D:\winpe_x86\mount. Because of this, we must reference the image as
d:\winpe_x86\mount. The command above therefore becomes:
DISM /Image:d:\winpe_x86\mount /Get-Packages
As you can see in Figure 2, DISM shows which packages are included in the image.
Device Driver Management
You can also use DISM to manage device drivers.
Vista had limited abilities for injecting drivers into an image, but DISM allows you to perform full-blown device driver management.
To enumerate the list of device drivers, enter the following command:
Once you know which device drivers are included in an image, you can add a driver to the image
by entering the following command:
For example, in Figure 3, I have issued the Get-Driver command, and Windows reported that there
were no third-party drivers in my image. I used the Add-Driver command to add a driver to the image
and then used the Get-Driver command once again to verify that the driver had been installed. If I
wanted to remove the driver, I could do so by entering the following command:
DISM /Image:d:\winpe_86\mount /remove-driver /driver:oem0.inf
Dismounting an Image
One minor problem with image management in Vista is that administrators would often forget to commit changes to .WIM files prior to dismounting them. In DISM, administrators are now prompted to either save or delete their changes prior to dismounting a .WIM image.
For example, in Figure 4, I have attempted to dismount an image by entering this command:
DISM /Unmount-WIM /Mountdir:d:\winpe_x86\mount
However, Windows says that I can't dismount the image unless I specify either the "/commit" or the "/discard" switch.
The DISM utility makes working with image files a lot easier. In case you are wondering, DISM commands are scriptable, and if you had previously set up automated Vista deployments, those are still supported.
ABOUT THE AUTHOR:
Brien Posey is a seven-time Microsoft MVP with two decades of IT experience. Before becoming a freelance technical writer, Brien worked as a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator at some of the nation's largest insurance companies and for the Department of Defense at Fort Knox.
This was first published in October 2009