Knowledge - Details


DISM Tips (WIM vs ESD, LimitAccess, paths with spaces)
Date Added: 4/22/2017

Your Windows installer ISO will either have install.wim or install.esd in the "Sources" folder.  If it has the ESD file, DISM will NOT work with it.  DISM only works with the WIM file.

LimitAccess = This tells DISM to NOT try to download any files from Windows Update (though even without this parameter, it still doesn't use WU for me)

Online = This tells DISM to scan/repair the currently booted operating system, as opposed to scanning an offline OS that you might have installed on a separate hard drive for dual boot or repair purposes.

These commands all work fine:
Without spaces in the path:
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:\\fileserver\Windows11ISOExtracted\sources\install.wim:1

With spaces in the path:
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:\\fileserver\Windows 11 ISO Extracted\sources\install.wim:1

With LimitAccess:
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:\\fileserver\Windows 11 ISO Extracted\sources\install.wim:1 /LimitAccess

With the wrong Edition number specified:
DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:\\fileserver\Windows 11 ISO Extracted\sources\install.wim:2 (this worked to repair a Pro machine using a Home WIM image)

Things to notice about the above commands:
If your path has spaces, you can surround the path with quotes.
If the path lacks spaces, you don't need the quotes.
The WIM index (:1 or :2) can either be inside the quotes or outside.  It works fine either way.
DISM DOES work ok with network paths.  It does NOT require mapped drives or mounted ISOs on the local machine.

Update for Windows 10 1703:
DISM does not like the wim: part of the Source value anymore.
DISM /Online /Cleanup-Image /RestoreHealth /Source:\\fileserver\Windows 11 ISO Extracted\sources\install.wim:1

----------------------------------------------------------------------------------
To see all the help documentation, you have to add parameters and then add /? again

dism /?
dism /online /?
dism /online /cleanup-image /?

----------------------------------------------------------------------------------
REM Ideal commands to run in order (to shrink the image and repair any corruption):

REM First, create a report about the component store
Dism /Online /Cleanup-Image /AnalyzeComponentStore

REM Second, see if the component store is already flagged as damaged
Dism /Online /Cleanup-Image /CheckHealth

REM Third, if the component store is not flagged as damaged, then run a full scan to see if it is actually damaged
Dism /Online /Cleanup-Image /ScanHealth

REM Fourth, if the component store is now flagged as damaged, repair it
Dism /Online /Cleanup-Image /RestoreHealth

REM Now that the component store is repaired, work on shrinking it
REM remove any backup files created during the installation of a service pack.
Dism /Online /Cleanup-Image /SPSuperseded
REM clean up the superseded components and reduce the size of the component store
Dism /Online /Cleanup-Image /StartComponentCleanup
REM reset the base of superseded components, which can further reduce the component store size. WARNING: This prevents you from uninstalling any past updates.
Dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase

REM finally, create a new report about the component store size
Dism /Online /Cleanup-Image /AnalyzeComponentStore

REM this is a good time to run the system file checker, since SFC uses files from the (freshly repaired) component store to replace any corrupt files it finds.
sfc /scannow
----------------------------------------------------------------------------------



Back to List

Disclaimer: Everything on this website is written for my own use. I disclaim any guarantees that the procedures and advice listed here are accurate, safe, or beneficial for anyone else. If you attempt to follow any procedures or advice shared here, you do it at your own risk. Part of IT work is knowing how to recover from problems.