Windows Deployment Image Servicing and Management (DISM) cheat-sheet

DISM is a tool that allows you to switch Windows editions and repair a broken Windows deployment.

Online Windows image operations

Get current Windows edition

DISM /Online /Get-CurrentEdition

Get Windows editions you can change to

DISM /Online /Get-TargetEditions

Change Windows edition and update product key

DISM /Online /Set-Edition:{:WindowsEdition:} /ProductKey:{:ProductKey:} /AcceptEula

Lists Windows features available and their state (Enabled/Disabled)

DISM /Online /Get-Features

Enable Windows Feature

DISM /Online /Enable-Feature /FeatureName:{:FeatureName:}

Enable Windows Feature and all of its dependencies

DISM /Online /Enable-Feature /All /FeatureName:{:FeatureName:}

Scans the Windows image for component store corruption

DISM /Online /Cleanup-image /ScanHealth

Scans the Windows image for component store corruption and performs repairs

DISM /Online /Cleanup-image /RestoreHealth

Offline Windows image operations (personally never had much success with these)

Scans an offline Windows image for component store corruption and performs repairs

DISM /Image:{:DriveLetter:}: /WinDir:{:WindowsFolder:} /Cleanup-image /RestoreHealth

When running offline from installation media you might need to specify a source ESD or WIM file to repair from

DISM /Image:{:DriveLetter:}: /WinDir:{:WindowsFolder:} /Cleanup-image /RestoreHealth /Source:WIM:{:InstallMediaDriveLetter:}:\sources\install.wim:{:ImageIndex:}

DISM /Image:{:DriveLetter:}: /WinDir:{:WindowsFolder:} /Cleanup-image /RestoreHealth /Source:ESD:{:InstallMediaDriveLetter:}:\sources\install.esd:{:ImageIndex:}

To identify which index you want from the source WIM/ESD run the following

DISM /Get-ImageInfo /ImageFile:{:SourceFilePath:}

You can mount the image index to a folder

DISM /Mount-Image /ImageFile:{:SourceFilePath:} /Index:{:ImageIndex:} /MountDir:{:MountDirectory:} /ReadOnly

Tags: #Os #Windows