How to: customize Windows images with DISM

In the initial release of Windows Server 2008 one of the the questions which always came up was “how do I add X” – the answer was we had tools named OCSETUP and OCLIST. These have been superseded in Windows 7 and Server 2008 R2 with the new Deployment Image Servicing and Management tool (DISM.EXE). The major thing of note about DISM is that it works with both the current running windows image and with offline images. So

DISM.exe /online /enable-feature /featurename=FailoverCluster-Core

adds failover clustering to a running edition of Server Core,but you can add it to a mounted VHD file (see previous post) on drive V

DISM.exe /image:V:\ /enable-feature /featurename=FailoverCluster-Core

DISM has some of the functions of ImageX (which is in the Windows Auto Installation Kit) – the ability to list the Images in a WIM (Windows Image) file, and to mount an image into the file system, and commit the changes made to it.

I thought I would have a go at reducing foot print of hyper-V server R2 (note that I’m working with the Release candidate and what is included may change before release) so I used DISM to remove the language packs, and configure the exact features I want. The following command gets a list if packeges

You can use Get-packageInfo and Get-Feature info to get more information about the features and packages. I decided to remove the 32 bit support (WOW64) and the East Asian Language support (EA-IME), and then put in the PowerShell support.

That’s done little more than scratch the surface, DISM can add drivers or patches (.MSU files) to an image, it can bring it into line with an Unattend.INF file, set input locales and timezones, even change the machine name. Now, the amount that you customize an existing WIM depends on whether or not you expect to install it enough times to make it worthwhile. It might be useful to update VHD files and of course it is the way to add features to server-Core or hyper-V installations.

Since the last post was about creating VHD files, you can guess that the next one will be about applying the images in WIM files to a VHD.