How to Capture Images of Hard Disk Partitions by Using DISM
Published: February 29, 2012
Updated: May 31, 2012
Applies To: Windows 8, Windows Server 2008 R2, Windows Server 2012
You can use the Deployment Image Servicing and Management (DISM) tool to capture an image of your hard disk for deployment and save it as a Windows® image (.wim) file.
-
A Windows PE disk. See Walkthrough: Install Windows PE to CD, USB Flash Drive, or USB Hard Drive for instructions about how to create a bootable Windows PE RAM disk.
-
A reference computer. You can create a reference computer by deploying Windows, and then removing the computer-specific information from the system. For more information, see How to Capture an Image for Deployment (Generalize).
This table shows the types of partitions that you must capture and those that are managed automatically.
| Partition type | Should you capture this partition? |
|---|---|
|
System partition (BIOS system partition or EFI System Partition) |
Optional. If only a simple set of partition files is required, you do not have to capture this partition. |
|
Microsoft Reserved partition (MSR) |
No. |
|
Primary partitions (Windows partitions, utility partitions) |
Yes. |
|
Extended partition |
No. |
|
Logical partitions (Windows partitions, utility partitions) |
Yes. |
You can capture and apply images between partitions on BIOS-based and UEFI-based computers, because the Windows image is not affected by the firmware. For more information, see How to Capture and Apply Windows, System, and Recovery Partitions.
If any of the partitions you want to capture do not already have a drive letter assigned, assign a letter using the DiskPart tool.
-
Start your reference computer by using Windows PE. For more information, see Booting Windows PE from RAM Disk.
-
At the Windows PE command prompt, type
diskpartto open the DiskPart tool.
X:> diskpart DISKPART>
-
Select the hard disk with the
select diskcommand. For example,
DISKPART> select disk 0
-
View the partitions with the
list partitioncommand. For example,
DISKPART> list partition DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 300 MB 1024 KB Partition 2 Primary 200 GB 301 MB
-
Select the partition with the
select partitioncommand. For example,
DISKPART> select partition=1
-
Assign a letter to the partition with the
assign lettercommand. For example,
DISKPART> assign letter=S
-
Type
exitto return to the Windows PE command prompt.
DISKPART> exit X:\>
For more information, see the DiskPart Help from the command line, or Diskpart Command line syntax.
Capture images for each customized partition.
-
At the Windows PE command prompt, capture the images by using the DISM command together with the /captureImage option. For example,
For more information about using the DISM tool to capture an image, see Image Management Command-Line Options.Dism /Capture-Image /ImageFile:c:\my-windows-partition.wim /CaptureDir:C:\ /Name:"My Windows partition" Dism /Capture-Image /ImageFile:s:\my-system-partition.wim /CaptureDir:S:\ /Name:"My system partition"
Save your .wim files to your network or another safe location.
-
Connect to your distribution share by using the net use command. For example,
If prompted, provide your network credentials.net use n: \\Server\Share
-
Copy the partitions to your network share. For example,
md N:\Images\ copy C:\my-windows-partition.wim N:\Images\ copy c:\my-system-partition.wim N:\Images\
After the image is captured and stored, you can:
-
Mount it to your reference computer for modification. For more information, see How to Mount and Modify an Image.
-
Split the file into smaller files. For more information, see How to Split a Windows Image (.swm) File to Span Across Multiple DVDs or CDs.
-
Apply the images to a destination computer. For more information, see How to Apply Images by Using DISM.
-
Service the image. For more information, see Service a Windows Image.
