DISM, ImageX and Diskpart Cheat Sheet

 •  Filed under cheat sheet, dism, imagex, diskpart

This page contains ImageX, DISM and Diskpart commands for the development and deployment of WIM disk images.

Obtaining WIM image information

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

Removing an index from a WIM image

imagex /delete "yourwimfilegoeshere.wim" indexnumbergoeshere

Merge a WIM file with another WIM file

imagex /export "C:\source\install.wim" 1 "C:\destination\install.wim"

Mounting a WIM image

dism /mount-image /imagefile:"yourwimfilegoeshere.wim" /index:indexnumbergoeshere /mountdir:"mountdirgoeshere"

Commit changes and unmount a WIM image

dism /unmount-wim /mountdir:"mountdirgoeshere" /commit

Discard changes and unmount a WIM image

dism /unmount-wim /mountdir:"mountdirgoeshere" /discard

Clean up left over files on the local machine

dism /cleanup-wim

Capture disk files to an image

dism /capture-image /imagefile:diskimage.wim /capturedir:Z:\ /name:"TestImage"

Deploy an image to a disk

imagex /apply "wimfilegoeshere.wim" 1 Z:\

New machine disk partitioning (BIOS)
diskpart

list disk  
select disk disknumberyouwanttomodify  
clean  
convert mbr  
create partition primary  
select partition 1  
active  
format fs=ntfs label=SystemPartition quick  
assign letter=Z  
exit  
New machine disk partitioning (UEFI/EFI)
diskpart

list disk  
select disk disknumberyouwanttomodify  
clean  
convert gpt  
create partition efi size=200  
assign letter=s  
format quick fs=FAT32  
create partition primary  
format fs=ntfs label=SystemPartition quick  
assign letter=Z  
exit  
Install bootloader in BIOS mode

bcdboot Z:\Windows

Install bootloader in UEFI/EFI mode

bcdboot Z:\Windows /s S: /f UEFI