Operating system instability, abrupt freezes, missing DLL errors, or broken shell applications are frequently caused by system file corruption. This occurs when updates terminate mid-way, hard drives encounter file-system write errors, or malware tampers with critical system files.
Instead of performing a full OS reinstall, Windows provides a native, layered recovery system: SFC (System File Checker) and DISM (Deployment Image Servicing and Management). Here is how to execute this sequence to restore system integrity.
1. The Diagnostic Hierarchy
Always run repairs from the bottom up. SFC relies on the local Component Store (C:\Windows\WinSxS) to get pristine replacement files. If the Component Store itself is corrupted, SFC will fail to repair files or report false negatives.
Therefore, the correct execution sequence is:
- DISM Check & Repair: Restores the health of the local Component Store.
- SFC Scan: Uses the clean Component Store to repair the active OS environment.
- CHKDSK scan: Validates the physical file system clusters (if files are corrupted by disk issues).
2. Running DISM (Component Store Recovery)
Open Command Prompt or PowerShell as Administrator.
Step 1: Scan for corruption
Before modifying files, verify if the component store has corruption:
dism /online /cleanup-image /checkhealth
If this reports “No component store corruption detected,” you can proceed directly to SFC. If it reports corruption, run the repair command.
Step 2: Restore health
To download pristine files from Windows Update and replace corrupted components:
dism /online /cleanup-image /restorehealth
What if DISM fails with a source error (e.g., 0x800f081f)?
If your network is restricted, or the local Windows Update client is broken, DISM will fail. You must specify an offline source using a Windows ISO:
- Mount a Windows ISO (double-click it in File Explorer). Let’s assume it mounts as drive
E:. - Locate the file
E:\sources\install.wimorE:\sources\install.esd. - Check which index represents your Windows edition (Home, Pro, etc.):
dism /get-wiminfo /wimfile:E:\sources\install.wim - Run the restore command pointing directly to that index (e.g., index
1for Pro):dism /online /cleanup-image /restorehealth /source:wim:E:\sources\install.wim:1 /limitaccess
3. Running SFC (System File Checker)
Once the component store is healthy, run the System File Checker to repair the active system binaries:
sfc /scannow
Analyzing the Output:
- “Windows Resource Protection did not find any integrity violations.”: Your system files are in a pristine state.
- “Windows Resource Protection found corrupt files and successfully repaired them.”: SFC fixed the issues. Look at
C:\Windows\Logs\CBS\CBS.logfor details of which files were fixed. - “Windows Resource Protection found corrupt files but was unable to fix some of them.”: This means SFC failed. Run DISM again (ensure
/restorehealthcompletes successfully), reboot, and rerunsfc /scannow.
4. Rebuilding Boot Configurations (BCD)
If the corruption has affected your boot sectors and the PC fails to load Windows (getting stuck at “Inaccessible Boot Device” or “BOOTMGR is missing”), you must repair the boot files using a bootable Windows USB installer.
- Boot from your Windows installation USB.
- Select your language, then click Repair your computer (bottom left).
- Go to Troubleshoot > Advanced Options > Command Prompt.
Run these commands in sequence depending on your partition style:
For MBR (Legacy) Systems
# Write a new Master Boot Record to the system partition
bootrec /fixmbr
# Write a new boot sector to the system partition
bootrec /fixboot
# Scan all disks for Windows installations and add them to the BCD
bootrec /rebuildbcd
For GPT (Modern UEFI) Systems
UEFI systems do not use /fixmbr. You must manually rebuild the EFI System Partition (ESP):
- Find the ESP partition letter using
diskpart:diskpart list disk select disk 0 list partition # Identify the partition labeled System (usually ~100MB, FAT32 format) select partition X assign letter=V exit - Re-create the bootloader folders on that partition:
(Replacebcdboot C:\Windows /s V: /f UEFIC:\with the actual volume letter of your main Windows OS if mapped differently in the recovery environment). - Reboot the computer. The UEFI firmware will now locate the rebuilt BCD menu.