brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: run DISM /RestoreHealth before sfc /scannow when Windows files are broken

Windows
~/tips/tip-windows-dism-restorehealth

sfc /scannow

Repairs the Windows component store, so sfc has good copies to fix system files with.

sfc /scannow fixes broken system files by replacing them with a cached copy. That only helps if the cache itself is fine. When it is not, sfc keeps failing, and DISM is the tool that repairs the cache.

Open Command Prompt or Terminal with Run as administrator, then:

DISM.exe /Online /Cleanup-Image /RestoreHealth
sfc /scannow

Microsoft’s own support article on the System File Checker gives that order: run DISM prior to running sfc. /Online means the Windows you are running right now, and /RestoreHealth repairs the image. By default it gets the files it needs from Windows Update, so make sure the PC is online. It can sit at a percentage for a long time; I’d let it finish.

If you want to look before you repair anything, the Learn page on repairing an image gives two checks:

DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /CheckHealth

/ScanHealth scans for corruption and takes several minutes. /CheckHealth then reports whether the image is healthy, repairable or not repairable.

Caveat: if Windows Update itself is broken, RestoreHealth cannot download anything. Then you point it at another source, such as the Windows folder of another running Windows installation or a side-by-side folder on a network share or USB stick, and add /LimitAccess so it does not try Windows Update at all:

DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess

The support article also says to keep the window open until the sfc verification reaches 100 percent.

Further reading: Microsoft Support: use the System File Checker tool, Microsoft Learn: repair a Windows image, On this site: sfc /scannow repairs corrupted Windows system files

More Windows tips Win+Ctrl+C Win+Shift+Left arrow Win+Ctrl+Left arrow Alt+PrtScn Left Alt + Left Shift + Print Screen All Windows tips (33) All topics

Link