Windows 11 – Imaging and Restoring with DISM

Introduction

This post covers only a basic usage of DISM! This post is a getting started guide for non-enterprise use cases.

At my school I was asked to create a preconfigured image of Windows 10 to quickly restore a functional Windows installation after the IT students are done training on them. My first thought was to use some disk cloning software, however the idea failed – I was given only a 16 GB USB stick to store the image. After a few minutes of googling I found the DISM (Deployment Image Servicing and Management) tool which is the official MS solution for mass deploying Windows. It allowed me to fit the image onto that unfortunate flash drive – the resulting file took only about 9 GB (due to not copying some files like pagefile.sys) and it includes a lot of deployment features like connecting to Active Directory or network interfaces!

Prerequisites

1. Install and Configure Windows

Install and configure Windows on a computer that will serve as the image. I don’t think I have to lead you through this one, just use the ISO linked above. You could use ninite - an automated application installer to power through common chores like installing web browsers or the OpenOffice suite.

2. Create an image

Burn Windows PE

We’ll need Windows PE (Windows Preinstallation Environment) to Once Windows ADK is installed, run Deployment and Imaging Tools Environment from the start menu. Type

Makewinpemedia /iso C:\winpe_amd64 C:\winpe_x64\winpe_amd64.iso

to get the Windows PE ISO and burn it to your external storage (e.g. with Rufus).

Boot Windows PE on the machine you want to clone

Dism /Capture-Image /ImageFile:D:\windows.wim /CaptureDir:C:\ /Name:"Windows Classroom 04"

where D is your external media and C is the windows partition to capture. If you don’t know what’s what, you can identify them by running diskpart and then list volume.

3. Restore an image

Restoring an image is a two part job:

Hence I stored two .bat scripts along the image:

partition.bat (careful, cleans the whole drive!):

select disk 0
clean
create part primary size=500
format quick fs=ntfs label="System"
active
assign letter="S"
create part primary
format quick fs=ntfs label="Windows"
assign letter="W"

restore.bat:

diskpart /s partition.bat
Dism /Apply-Image /imagefile:windows.wim /index:1 /ApplyDir:W:\
W:\Windows\System32\bcdboot W:\Windows

More possibilities

As I mentioned DISM is way more powerful and it gets more features with every release. Here’s the changelog: What’s new in ADK kits and tools. If you require things like generating the username, connecting to Active Directory, configuring network interfaces I encourage you to take a look at this page.