Windows repair
Repair a Windows image with DISM and SFC
Fix component store corruption with DISM, then repair protected system files with SFC — in that order, and with a local source when Windows Update can't be used.
Use this when updates fail with corruption errors such as 0x800f081f or 0x80073712, when Windows features won't install, or when sfc reports files it can't fix.
Why DISM comes first
SFC repairs system files from the component store (C:\Windows\WinSxS). If the store itself is damaged, SFC copies damaged files back. DISM repairs the store; SFC then has a good source.
1. Check the component store
Run in an elevated prompt:
1DISM /Online /Cleanup-Image /CheckHealth # quick: reads the flag set by earlier scans2DISM /Online /Cleanup-Image /ScanHealth # full scan, several minutes2. Repair it
1DISM /Online /Cleanup-Image /RestoreHealthBy default DISM downloads replacement files from Windows Update. On machines that get updates from WSUS or Configuration Manager this often fails with 0x800f081f (source files not found). Use installation media of the same build and edition instead:
1# Mount the ISO, then find the index of the installed edition2DISM /Get-WimInfo /WimFile:D:\sources\install.wim3 4# Repair from that index only, without contacting Windows Update5DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\sources\install.wim:3 /LimitAccessIf the media has install.esd instead, use /Source:esd:D:\sources\install.esd:3.
3. Repair system files
1sfc /scannowTo see what SFC changed, extract its entries from the CBS log:
1Select-String -Path $env:windir\Logs\CBS\CBS.log -Pattern '\[SR\]' | Out-File $env:USERPROFILE\Desktop\sfc-details.txtLogs
| Log | Path |
|---|---|
| DISM | C:\Windows\Logs\DISM\dism.log |
| Servicing (CBS) and SFC | C:\Windows\Logs\CBS\CBS.log |
Restart after repairs, then retry the update or feature that failed.
References
- Repair a Windows image — Microsoft Learn