Command line

Run DISM and SFC health repair in the right order

The DISM and SFC commands to repair Windows system files, in the right order, with the log files to read after.

LanguageBatch
What it does to the systemMakes changes. Test it on one computer first.

These commands repair damaged Windows system files. Use them when updates fail with component store errors, or Windows features stop working.

Order matters. DISM repairs the component store first. SFC then uses that store to repair the system files.

Batch
rem 1. Quick check. Reads the damage flag only. Takes a few seconds.
DISM /Online /Cleanup-Image /CheckHealth

rem 2. Full scan of the component store. Changes nothing. Can take 10 minutes or more.
DISM /Online /Cleanup-Image /ScanHealth

rem 3. Repair the component store.
DISM /Online /Cleanup-Image /RestoreHealth

rem 3b. Use this in place of step 3 when the computer cannot reach Windows Update.
rem     D: is a mounted Windows ISO of the same version and language. 1 is the image index.
rem DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:1 /LimitAccess

rem 4. Repair the system files from the store.
sfc /scannow

How to use it

  1. Open a Command Prompt as administrator on the computer.
  2. Run steps 1 to 4 in order. Wait for each one to finish.
  3. If step 3 fails with 0x800f081f, mount a matching Windows ISO. Then run step 3b without the rem.
  4. Restart the computer when SFC reports that it repaired files.
  5. Read C:\Windows\Logs\DISM\dism.log and C:\Windows\Logs\CBS\CBS.log if a step fails.

Good to know

  • Step 3 downloads repair files from the update source of the computer. On an SCCM or WSUS client that source often does not have them, so step 3b is common.
  • To see the image index numbers in an ISO, run DISM /Get-WimInfo /WimFile:D:\sources\install.wim.
  • Some ISOs hold install.esd and no install.wim. Then use /Source:ESD:D:\sources\install.esd:1.
DISM SFC RestoreHealth component store system files
✉

Get new articles in your inbox

SCCM guides, AI tools, automation tips — sent when published. No spam.