What is DISM?
dism.exe has two jobs. For support work, it checks and repairs the Windows component store (WinSxS), the local library of system file versions that Windows Update and sfc rely on. For deployment work, it services Windows images: listing the editions in a .wim file, mounting an image, adding drivers, updates and optional features, and saving the changes. DISM is built into Windows and is also available in Windows PE and the Windows Recovery Environment.
Repairing a running Windows installation
Run these from an elevated Command Prompt or PowerShell. /Online means the copy of Windows that is running now.
| Command | What it does |
|---|---|
DISM /Online /Cleanup-Image /CheckHealth | Quick check of whether corruption has already been recorded; no deep scan and no changes |
DISM /Online /Cleanup-Image /ScanHealth | Full scan of the component store; reports problems but repairs nothing, and takes longer |
DISM /Online /Cleanup-Image /RestoreHealth | Scans and repairs the store, downloading clean files from Windows Update by default |
If the PC cannot reach Windows Update, or RestoreHealth fails with error 0x800f081f (source files could not be found), point it at installation media for the same Windows version: DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\sources\install.wim:1 /LimitAccess. The :1 is the image index, which should match the installed edition, and /LimitAccess stops DISM from contacting Windows Update. Some media carry install.esd instead, which uses the esd: prefix. In PowerShell, Repair-WindowsImage -Online -RestoreHealth runs the same repair. DISM logs to C:\Windows\Logs\DISM\dism.log.
DISM and sfc
sfc repairs individual protected system files by copying good versions out of the component store, so a damaged store leaves sfc unable to finish. The common sequence is: run sfc /scannow; if it reports corrupt files it could not fix, run DISM /Online /Cleanup-Image /RestoreHealth; then run sfc /scannow again. Microsoft's support article reverses the first two steps, running DISM first and sfc second. Both orders end with a repaired store and a clean sfc pass. If DISM itself cannot repair the store, the next step is a repair installation.
Servicing offline images
Replace /Online with /Image: to work on a copy of Windows that is not running, such as an unbootable installation seen from the recovery environment (DISM /Image:D:\ /Cleanup-Image /RestoreHealth /Source:...) or a mounted image file. Typical image work includes:
DISM /Get-ImageInfo /ImageFile:D:\sources\install.wimlists the editions and index numbers inside an image.DISM /Mount-Image /ImageFile:C:\images\install.wim /Index:1 /MountDir:C:\mountmounts one edition into a folder.DISM /Image:C:\mount /Add-Driver /Driver:C:\drivers /Recurseadds drivers, andDISM /Unmount-Image /MountDir:C:\mount /Commitsaves the changes back into the .wim.DISM /Online /Get-FeaturesandDISM /Online /Enable-Feature /FeatureName:list and enable optional Windows features.DISM /Online /Cleanup-Image /StartComponentCleanupremoves superseded component versions to reclaim disk space.
A .wim (Windows Imaging Format) file is file-based, can hold several editions in one file, and is the format of the install.wim on Windows installation media. That is why imaging and deployment tools are built around DISM.
DISM on the CompTIA A+ exam
DISM is one of the command-line tools in Core 2 (220-1202) objective 1.5 and a repair step in the Windows troubleshooting scenarios of objective 3.1. Know the expansion, Deployment Image Servicing and Management, the RestoreHealth command, the difference between CheckHealth, ScanHealth and RestoreHealth, and how DISM pairs with sfc. Cue: sfc /scannow found corrupt files but could not fix some of them, think DISM /Online /Cleanup-Image /RestoreHealth, then sfc again. Image-servicing switches matter more on the job than on the exam, but knowing that DISM works with .wim images helps with deployment questions.