When All Hell breaks lose (part 1): Repairing Windows System Files

If your Windows PC is acting up—crashing, freezing, or showing strange errors—it could be due to corrupted or missing system files. Thankfully, Windows includes built-in tools to help you repair these files without needing a complete reinstall. SFC (System File Checker) and DISM (Deployment Imaging Service and Management) are two of the most essential tools.

In this post, I’ll explain the basics of using these tools to restore your system’s health.

What Is SFC?

SFC scans the integrity of Windows system files and replaces any corrupted or missing ones with the correct versions from the Windows component store.

How to Use SFC:

  1. Open Command Prompt (CMD) or PowerShell as Administrator
  2. In the Command Prompt, type:
    SFC /SCANNOW
  3. Press Enter and wait. This can take several minutes.
  4. After the scan completes, you’ll see a message. Possible results include:
    Windows Resource Protection did not find any integrity violations.
    Windows Resource Protection found corrupt files and successfully repaired them.
    Windows Resource Protection found corrupt files but could not fix some of them.

If SFC cannot fix everything, that’s where DISM comes in.

What Is DISM?

DISM stands for Deployment Imaging Service and Management. It can repair the Windows image itself, including the files SFC depends on to perform repairs. This is especially useful when SFC reports unrepairable errors.

DISM has many options to choose from related to repairing Windows. Here are the most important ones:

  • /ScanHealth – Checks image for corruption, no repairs.
  • /CheckHealth – Quick check if corruption has already been detected.
  • /RestoreHealth – Scans and repairs corruption using Windows Update.
  • /Source – Specify alternate repair source (e.g., ISO)
  • /LimitAccess – Prevents DISM from contacting Windows Update servers (often used with /Source).
  • /AnalyzeComponentStore – Shows WinSxS size and cleanup suggestions.
  • /StartComponentCleanup – Removes old Windows Update files and backups.

How to Use DISM:

  1. Open Command Prompt (CMD) or PowerShell as Administrator
  2. Run the following command to scan the health of the system image:
    DISM /Online /Cleanup-Image /ScanHealth
    This checks for corruption but doesn’t fix anything.
  3. To actually repair the image, e.g if /ScanHealth states that it is repairable, use:
    DISM /Online /Cleanup-Image /RestoreHealth
    This will fetch the necessary files from Windows Update. Depending on your system and internet speed, it may take some time.
  4. After DISM finishes, restart your computer (not Shutdown!)
  5. Should SFC have failed the first time, or could not repair everything, execute it once more

These two Tools, SFC and DISM, repair most System files. As long as these files are not in their best condition, further system repair steps (e.g., running troubleshooter, debugging System Errors, etc.) may be fruitless since any Windows component, Driver, program, or even the troubleshooter, requires the Windows Core System to be healthy.

Hint:

I’ve created a PowerShell module which performs all these steps and much more for you. You can download the installer here (please read the README first on Github: PowerShell-Tools, as well as the module Readme in the .\modules\ Subfolder)


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *