Windows Deployment is the core task of network infrastructure when a system administrator want to install clients operating system too fast at a short period of time. To customize Windows image with Deployment Image Service and Management (DISM) tool will help you to create a thin image which contain all necessary software, Apps and drivers.
Understanding Windows Image Files
There are two images (Install.wim and Boot.wim) on the installation Windows DVD. You can find them within the Sources folder.
- Install Image: Is used to install the full Windows operating system. Install images can include operating system, applications, configuration changes and several install images.
- Boot Image: The primary purpose of boot.wim image is to load a minimal operating system and boot the system to Windows pre-execution environment (WinPE) so that the full operating system to be loaded, or to perform troubleshooting.
To see the complete information of an Image using DISM command see the following command.
dism /get-wiminfo /wimfile:d:\sources\install.wim
The result shows that image is a Windows 8.1 Enterprise Evaluation with Index number of 1 and size is in bytes. Let’s see the information of a different image.
dism /get-wiminfo /wimfile:i:\sources\install.wim
Yes it is a Windows Server 2012 R2 with 4 different edition. Now you must completely understand the Index number of Images.
To see the information of Boot image, execute the same command and type boot.wim instead of install.wim image.
dism /get-wiminfo /wimfile:i:\sources\boot.wim
Do the similar task on Pre-execution environment (PE) with the following Imagex command line.
imagex /info d:\sources\install.wim
So you became familare with Windows images and know the differences between install and boot image and knowing how to get information of an image with DISM command line tool.
Customize Windows Image With DISM
A custom image mostly called thick image contains all software, applications and drivers unlike the thin Image that only includes operating system image. To customize Windows Image you must mount the install image offline services.
To customize windows image, firstly copy the install.wim image from Windows installation DVD to a folder then mount it with the following DISM command.
dism /mount-wim /wimfile:e:\image\install.wim /index:1 /mountdir:e:
It takes a few minutes to completely mount the image.
- The /wimfile: point the location of install.wim image.
- The /index: shows the index number within .wim image which previously explained.
- The /mountdir: point the path of mounted image, where the extracted image files are located.
Here is the mounted files of install.wim image. Now to see the mounted image information, just type “dism /get-mountedwiminfo” command.
OK, now time to modify the image using DISM.
You can customize the below options and features of windows image.
- Add Windows drivers
- Add or remove packages and features
- Miscellaneous image modifications
Lets starting to add and remove some Windows features to this image. To add a package you must know the existing features and packages within your image.
To see the packages information type the following command. “dism /image:c:\mountedimages /get-packages”. It list all existing packages.
The best practice is to export all packages to a txt file.
dism /image:c:\mountedimages /get-packages /format:table >ImagePackages.txt
The list’s of exported packages in a text file. In order to see the exact package information type the following command.
dism /image:c:\mountedimages /get-packageinfo /packagename:Package_for_KB976902~31bf3856ad364e35~amd64~~6.1.514
You can check to see if any patches have been applied to applications within the system with the /get-apppatchinfo switch.
dism /image:c:\mountedimages /get-apppatchinfo
How to add a Package?
In order to add a package to your custom image, firstly download the package then add it.
dism /image:c:\mountedImages /add-package /packagepath:c:\downloadPackages\(package name)
To remove a package from your custom image do it with remove-package command.
dism /image:c:\mountedimages /remove-package /packagename:(Package name)
To enable and disable a features, do it with disable-feature or enable-feature, see more How to Install Windows Features Offline?.
To enable a features: “dism /image:c: \mountedImages /enable-feature /featurename: (Feature name)”.
To remove a feature: “dism /image:c: \mountedImages /disable-feature /featurename: (Feature name)”.
How to set a license key?
In order to set the product key, type “dism /image:c:\mountedImages
/set-productkey: (Enter the key)”.
How to Save the Custom Image?
Finally, after editing images try to save it with dism /commit-wim command.
dism /commit-wim /mountdir:c:\mountedimages
This command apply offline changes to image and save it. Then you should unmount the image using dism /unmount-wim command.
dism /unmount-wim /mountdir:c:\mountedimages /commit
When you un-mount the image, the mounted files will no longer available to mounted folder and removed.
Now the custom image is ready to deploy with Windows Deployment Services or System Centre.
OK. These are the essential dism commands to customize windows image for windows deployment. I hope you to find this Customize Windows Image article helpful and if you need more information? just type dism /? to get the dism helps or ask your question through comment.