Repair Windows system files with DISM and SFC
To repair corrupted Windows system files, run DISM RestoreHealth to fix the component store, then sfc /scannow to fix the files, both as administrator.
In an administrator terminal, run DISM /Online /Cleanup-Image /RestoreHealth, then sfc /scannow.
The steps and the reason are below.
Windows keeps a spare copy of its system files in the component store. DISM checks and repairs that store, and SFC then checks the system files themselves and replaces broken ones from it. Run them in that order: SFC can only repair from a healthy store.
Check the component store with DISM
DISM has two checks that only report problems. Neither one changes anything.
The quick check, CheckHealth, reports whether Windows has already flagged the image as healthy, repairable or non-repairable:
DISM /Online /Cleanup-Image /CheckHealth
The deeper check, ScanHealth, looks through the whole store for corruption. It takes several minutes:
DISM /Online /Cleanup-Image /ScanHealth
Repair the component store with DISM RestoreHealth
The repair, RestoreHealth, scans the store and replaces anything broken with good copies from Windows Update:
DISM /Online /Cleanup-Image /RestoreHealth
It can sit at the same percentage for a long time and look stuck. Leave it running until it finishes.
Repair from install media instead of Windows Update
When Windows Update is broken or the PC is offline, DISM can take its good copies from a Windows ISO or USB stick instead. Use media with the same edition and version as the installed Windows.
- Mount the ISO
Double-click it in File Explorer. It opens as a new drive, here
D:. - Find your edition’s index
The image holds several editions. List them and note the index of the one you have installed, for example Windows 11 Pro:
DISM /Get-WimInfo /WimFile:D:\sources\install.esd - Repair from that image
Put your index after the last colon, in place of
6:DISM /Online /Cleanup-Image /RestoreHealth /Source:esd:D:\sources\install.esd:6 /LimitAccess
The /LimitAccess switch stops DISM from falling back to Windows Update. If the sources folder has install.wim instead of install.esd, use that name in both commands and write wim: in place of esd:.
Check and repair system files with SFC
With the store healthy, the System File Checker checks every protected system file. To check without changing anything:
sfc /verifyonly
To check and repair:
sfc /scannow
Keep the window open until verification reaches 100%.
What does the SFC result mean?
| SFC says | What to do |
|---|---|
| Windows Resource Protection did not find any integrity violations. | Nothing. Your system files are fine. |
| Windows Resource Protection found corrupt files and successfully repaired them. | Nothing more. The repairs are in the log. |
| Windows Resource Protection found corrupt files but was unable to fix some of them. | Run DISM RestoreHealth again, then sfc /scannow again. If files still fail, the log names them. |
| Windows Resource Protection could not perform the requested operation. | Start Windows in Safe Mode and run sfc /scannow there. |
Find the details in the logs
Both tools keep a log. SFC writes to the CBS log at C:\Windows\Logs\CBS\CBS.log, and DISM to C:\Windows\Logs\DISM\dism.log. The CBS log holds a lot more than SFC, so this copies just the SFC lines to a file on your desktop:
Select-String -Path $env:windir\Logs\CBS\CBS.log -Pattern '\[SR\]' |
ForEach-Object Line |
Set-Content "$env:USERPROFILE\Desktop\sfcdetails.txt"
The file holds every SFC run, so look at the dates for the latest one.
Microsoft’s own pages: Repair a Windows image, Use the System File Checker tool and the sfc command reference.