The imaging of Windows based computers can be performed with DISM (Deployment Image Servicing and Management) and a Windows PE Environment (Windows Pre-installation Environment). Both are available as part of the Windows Assessment and Deployment Kit (ADK) for Windows.

DISM can work with two different image types. The Virtual Hard Disk (VHD) was designed for virtualisation and represents the physical disk. Windows Imaging Format (WIM) is a file-based disk image format developed to help deploy Vista and subsequent versions of Windows.

WIMs are the preferred method of imaging. It supports compression, single instancing (only one copy of identical files are captured) and has better support for offline maintenance tasks.

The Windows PE Environment is a lightweight version of windows that can be loaded from removable media. It allows command line executables such as dism.exe to be executed on the host computer. Upon boot-up the C:\windows\system32\startnet.cmd file is executed and can be used to automate the deployment process.

Mapping Network Drives

WIM images can be stored on a NAS or network share for ease of backup and recovery. The net command can be used to map network shares within the Windows PE environment:

net use z: \\\Images

Creating an Image

Creating a WIM image can be performed by booting into Windows PE and using the following command:

dism /Capture-Image /ImageFile:z:\Images\Saturn.wim /CaptureDir:H:\ /Name:"Clean Windows 8 install on Saturn"

Deploying an Image

A WIM image can be applied to the target machine by partitioning and formatting the hard disk drive, restoring (applying) the WIM to the windows partition and creating the boot configuration data (BCD).

Partitioning the hard disk

Create a system and windows partition by issuing diskpart.exe the following commands (These commands can be passed to diskpart.exe as a script)

Select disk 0
create partition primary size=100
format quick fs=fat32 label="System"
assign letter="S"
create partition primary
format quick fs=ntfs label="Windows"
assign letter="W"

Apply the image to the windows partition

dism /apply-image /imagefile:z:\Images\Saturn.wim /index:1 /ApplyDir:W:\

Create a basic system partition

Use BCDboot to create a basic system partition for booting. The BCDboot tool will copy a simple set of system files to a system partition. These files include boot configuration data (BCD) information that is used to start Windows.

bcdboot W:\Windows /s S:


Reboot into your newly restored image.

Mounting an Image

WIMs can be mounted with read/write permissions for servicing. Create a mount point directory on your host. In this example, I use the D:\mount mount point

dism /Mount-Image /ImageFile:z:\images\saturn.wim /Index:1 /MountDir:D:\mount

The contents of the WIM should now be present in D:\mount\

Any changes can be committed using:

dism /Commit-Image /MountDir:D:\mount

Alternatively, any changes can be committed and the WIM unmounted using:

dism /Unmount-Image /MountDir:D:\mount /Commit

WIMs can be unmounted and any changes discarded using:

dism /Unmount-Image /MountDir:D:\mount /Discard