Windows DISM and SFC
π Resources π
Intro
Windows keeps many of its core system files, update payloads, and servicing metadata inside the component store, commonly associated with the WinSxS folder. When that store becomes inconsistent or corrupted, Windows Update may fail, sfc /scannow may be unable to repair files, and the system may show unexplained instability.
This guide walks through a safe repair workflow using two built-in Windows tools:
DISM - repairs the Windows image and component store.
SFC - verifies and repairs protected Windows system files.
Applies to: Windows 10 and Windows 11
Requirement: Run all commands from an elevated Command Prompt, Windows Terminal, or PowerShell session.
Quick repair sequence
Open Command Prompt, PowerShell, or Windows Terminal as Administrator, then run:
After both tools complete, reboot Windows.
Then check whether the component store can be cleaned up:
The final AnalyzeComponentStore run lets you compare the component store size before and after cleanup.
What each command does
DISM /Online /Cleanup-Image /CheckHealth
Performs a quick check to see whether Windows has already flagged the component store as corrupted. This command is fast because it does not perform a full scan.
DISM /Online /Cleanup-Image /ScanHealth
Performs a deeper scan of the component store. This can take several minutes.
DISM /Online /Cleanup-Image /RestoreHealth
Scans the Windows image for component store corruption and automatically attempts repairs. By default, DISM can use Windows Update as a repair source when required.
sfc /scannow
Scans protected Windows system files and replaces corrupted files when possible. Run this after DISM so SFC can rely on a repaired component store.
DISM /Online /Cleanup-Image /AnalyzeComponentStore
Reports component store size, reclaimable packages, cache data, and whether cleanup is recommended.
DISM /Online /Cleanup-Image /StartComponentCleanup
Removes superseded components and reduces the size of the component store. This is useful after successful repairs or after installing many cumulative updates.
Recommended step-by-step workflow
1. Update and reboot first
Before repairing system files, install pending Windows updates and restart if Windows asks you to. This avoids repairing an image while update operations are still pending.
2. Open an elevated terminal
Use one of these methods:
Press Start.
Search for Command Prompt, PowerShell, or Windows Terminal.
Right-click it and choose Run as administrator.
3. Check component store health
Use this as a quick first pass. If Windows reports that the component store is repairable, continue with the deeper scan and repair commands.
4. Run a deeper DISM scan
This checks for corruption more thoroughly. It may appear to pause at certain percentages; that is usually normal.
5. Repair the Windows image
A successful result usually ends with:
DISM logs details here:
6. Run System File Checker
Common results include:
Windows Resource Protection did not find any integrity violations. No protected system file corruption was found.
Windows Resource Protection found corrupt files and successfully repaired them. SFC repaired the detected files.
Windows Resource Protection found corrupt files but was unable to fix some of them. Review the CBS log and consider running DISM again or using a known-good repair source.
SFC logs details here:
To extract only SFC entries to your desktop:
7. Reboot Windows
Restart the system after DISM and SFC complete. This helps Windows finish any pending servicing work and gives you a clean baseline for testing.
Cleaning up the component store
The scheduled task located at Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup automatically removes outdated and superseded Windows component-store files during maintenance to reduce WinSxS size and improve servicing efficiency.
After repairs are complete, check whether cleanup is recommended:
If the report says:
run it manually:
Then run the analysis again:
Example result
In one real cleanup run, the component store changed from:
to:
That reclaimed roughly 4.51 GB of component store space.
β Avoid manually deleting files from
C:\Windows\WinSxS. Use DISM, Disk Cleanup, or Storage settings instead.
Optional: use a local repair source
If RestoreHealth fails with an error such as 0x800f081f, Windows may not be able to find the files needed for repair. In that case, mount a Windows ISO that matches your installed Windows version, edition, architecture, and language.
First, check which image indexes are available:
Then run DISM with a source path:
If your ISO uses install.esd instead of install.wim, use:
Replace D: with the drive letter of your mounted ISO, and replace 1 with the correct image index for your edition.
/LimitAccess prevents DISM from contacting Windows Update and forces it to use the specified source.
Optional disk check
If you suspect file-system or disk problems, start with an online scan:
Only use the offline repair options when needed:
/f may require a reboot on the system drive. Use /r only when you specifically need a surface scan for bad sectors, because it can take a long time on large drives.
When to use this workflow
Use this repair sequence when you see symptoms such as:
Windows Update repeatedly fails.
sfc /scannowcannot complete or cannot repair files.Windows components, services, or built-in apps behave inconsistently.
You see component store corruption in DISM output.
You want to clean up superseded Windows components after updates.
This workflow is usually safer than jumping straight to an in-place upgrade, reset, or clean installation.
What not to do
Do not manually delete the WinSxS folder or files inside it.
Do not run random cleanup scripts against component store folders.
Do not use /ResetBase unless you understand the trade-off. This can remove superseded component versions and prevent uninstalling existing Windows updates.
Do not interrupt DISM just because it appears paused at a percentage. Some stages can take several minutes.
Maintenance routine
For normal systems, you do not need to run deep repair scans constantly. A practical routine is:
Keep Windows Update current.
Run
sfc /scannowif you suspect system file corruption.Run
DISM /Online /Cleanup-Image /ScanHealthwhen Windows Update, SFC, or system stability issues suggest component store problems.Run
DISM /Online /Cleanup-Image /AnalyzeComponentStoreafter large update cycles if you want to check whether cleanup is recommended.
Final command checklist
Last updated