Stone Computers Knowledgebase

Working with Windows Image Files (WIM) - How to Mount Them and Add Drivers

Article ID: 629
Last updated: 23 Nov, 2016
Article ID: 629
Last updated: 23 Nov, 2016
Revision: 6
Views: 43667
Posted: 21 Nov, 2016
by Andrew Sharrad
Updated: 23 Nov, 2016
by Andrew Sharrad

WIM Files

Windows Image File are used to store boot-up images (for example, images that run Windows Setup from CD or USB, or Network Boot), Windows PE (again, from CD, USB or Network boot) or entire operating system images.

Example: Most bootable media - CD drives and USB drives - will contain a WIM file called BOOT.WIM in the Sources folder.

WIM files can be manipulated using systems such as MDT or WDS, to add drivers or distribute them out to clients.

On occasion, it can be necessary to manually mount a WIM file to add drivers, or to inspect the contents. This article will cover the basics.

The Tools You Need

You will need the Windows Assessment and Deployment Kit (ADK) to load images. For some image functions - for example, adding drivers, your ADK version must match, or be greater, than the version of the operating system contained inside the image. Sometimes the version of operating system you are running also matters. For example, the Windows 10 versions of the ADK are operating system specific. The 1511 version of the kit requires Windows 10, version 1511.

Windows ADK Page here.

Seeing What Images Are Contained Inside a WIM File

You can do this without mounting, or extracting, the WIM file.

Instructions:

  • After installing the Windows ADK, open up the Deployment Tools Command prompt. This will give you easy access to the DISM.EXE utility.
  • Run the command below against the WIM file, in this case, BOOT.WIM in the Stone folder.

dism /get-wiminfo /wimfile:"boot.wim"

  • The Index number tells you how to reference the image with other DISM commands. For example, the Windows PE Image above can be accessed using Image Index 1.

Mounting the WIM File

  • Make a directory for the mounted files. This directory should be empty. In the examples below, this d:\Mount.
  • You will need the Index number of the image you want to mount, for example Index 1, from above.
  • Again using the Deployment Services command prompt and DISM, run the command below.

dism /mount-wim /wimfile:"boot.wim" /index:1 /mountdir:"d:\mount"

  • Or for reading only - without changes being permitted:

dism /mount-wim /wimfile:"boot.wim" /index:1 /mountdir:"d:\mount" /readonly

  • This will then give you a folder that you can browse with Windows Explorer.

Adding Drivers to A Mounted Image

You can add drivers to an image using the DISM command.

  • To add drivers from a specific driver INF file:

dism /Image:"d:\mount" /Add-Driver /Driver:"e:\drivers\video\mydriver.inf"

  • To add drivers from a folder:

dism /Image:"d:\mount" /Add-Driver /Driver:"e:\drivers\video"

  • And lastly, to add drivers from a folder and all subfolders:

dism /Image:"d:\mount" /Add-Driver /Driver:"e:\drivers" /recurse

Unmounting the File

When you are finished, the Image must be unmounted, even if you do not wish to save any changes.

  • To unmount an image, without saving changes run the following:

dism /unmount-Wim  /MountDir:"d:\mount" /discard

  • To unmount an image, saving any changes you have made instead run the following:

dism /unmount-Wim  /MountDir:"d:\mount" /commit

Applies to:

  • Windows Server and Windows Client Deployment Tools

This article was:  
Article ID: 629
Last updated: 23 Nov, 2016
Revision: 6
Views: 43667
Posted: 21 Nov, 2016 by Andrew Sharrad
Updated: 23 Nov, 2016 by Andrew Sharrad
Also read

Also listed in