Repair Windows system files with SFC and DISM
In short
- Microsoft says to run DISM before System File Checker, because DISM provides the files required to repair corrupted files1.
- Dism /Online /Cleanup-Image /ScanHealth scans the image for component store corruption and takes several minutes3.
- Dism /Online /Cleanup-Image /CheckHealth reports whether the image is healthy, repairable or non-repairable2.
- If Windows Update is broken, add /Source and /LimitAccess so DISM repairs from a local Windows folder and doesn't contact Windows Update1,3.
- SFC writes its details to %windir%\Logs\CBS\CBS.log, which you can filter into a text file on your desktop1.
To repair Windows system files, open Command Prompt as administrator and run DISM.exe /Online /Cleanup-image /Restorehealth first1. DISM provides the files needed for the repair and uses Windows Update as its source1. Then run sfc /scannow, which scans all protected system files and replaces corrupted ones with a cached copy1. Keep the window open until the scan is 100% complete1.
Before you start
Missing or corrupted system files can make Windows features fail, cause system errors or make Windows freeze1. Windows has two built-in repair tools for this. DISM restores damaged Windows components, and System File Checker (SFC) scans for corrupted system files1.
You need an administrator account, because both tools run in an elevated Command Prompt1. DISM uses Windows Update as its repair source, so stay online1. If Windows Update is broken, you can use a running Windows installation or a Windows side-by-side folder from a network share or removable media instead1.
Each command can take several minutes1. Don't close the window until SFC reaches 100%1.
Steps
Open an elevated Command Prompt. Type cmd in the Search box. In the results, right-click Command Prompt and select Run as administrator1. If Windows asks for confirmation or an administrator password, type the password or click Allow1.
Check the image first (optional). This scan looks for component store corruption and takes several minutes2,3:
Dism /Online /Cleanup-Image /ScanHealthThen run this command to see the result. DISM reports whether the image is healthy, repairable or non-repairable2:
Dism /Online /Cleanup-Image /CheckHealthRepair the image with DISM. Type this command and press Enter. It may take several minutes1:
DISM.exe /Online /Cleanup-image /Restorehealth/RestoreHealth scans the image for component store corruption and then repairs it automatically3.
Use a repair source if Windows Update is broken. Run this command instead of the one in step 3. Replace C:\RepairSource\Windows with the location of your repair source1:
DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess/LimitAccess stops DISM from contacting Windows Update3. If you give more than one /Source, DISM copies files from the first location where it finds them2.
Run System File Checker. In the same window, type this command and press Enter1:
sfc /scannowSFC scans all protected system files and replaces corrupted files with a cached copy1. Don't close the window until the verification is 100% complete1.
Check it worked
When DISM succeeds, Command Prompt says "The restore operation completed successfully" or "The operation completed successfully"4. If you don't see a confirmation message, retype the command and try again4.
SFC shows its result when the scan ends1:
- "Windows Resource Protection did not find any integrity violations." You don't have any missing or corrupted system files1.
- "Windows Resource Protection found corrupt files and successfully repaired them." The repair worked1.
To see what SFC found, copy its entries from the log to a text file on your desktop1:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"The file holds details from every SFC run, so check the date and time of each entry1.
Common problems
"Windows Resource Protection could not perform the requested operation." Run the SFC scan in safe mode1. To get there, open Windows RE and select Troubleshoot > Advanced options > Startup Settings > Restart, then pick Enable Safe Mode5. Also make sure the PendingDeletes and PendingRenames folders exist under %WinDir%\WinSxS\Temp1.
"Windows Resource Protection found corrupt files but was unable to fix some of them." Use sfcdetails.txt to find the file SFC couldn't repair1. Replace it with a known good copy, for example from another computer that runs the same version of Windows1. Microsoft's steps take ownership of the file, give administrators full access, then copy the good file over it1:
takeown /f <Path_And_File_Name> icacls <Path_And_File_Name> /grant administrators:F Copy <Source_File> <Destination>DISM can't get repair files. By default, DISM gets them from Windows Update1. Point it at a repair source with /Source and add /LimitAccess, as in step 41,3.
Questions
- Should I run SFC or DISM first?
- DISM first. Microsoft says to run DISM before System File Checker, because DISM provides the files SFC needs to repair corrupted files1.
2 Oct 2026: Published.