How to Use DISM Command Line to Repair Windows Image (Complete Guide)

use DISM Restorehealth command

DISM stands for Deployment Imaging Service and Management Tool. It is a command-line tool used by IT administrators and advanced users to service and repair Windows images (.wim or .esd files), including the Windows Recovery Environment (WinRE), Windows Setup, and Windows PE (Preinstallation Environment). It can also be used to scan the integrity of your Windows image and restore corrupted system files, which helps bring your Windows installation back to a healthy state. The DISM Restore Health command dism /online /cleanup-image /restorehealth, is particularly useful if System File Checker (SFC) fails to repair corrupt file or if Windows Update isn’t functioning properly. Whether you’re troubleshooting system errors or fixing corrupted system files, here is how you can use the DISM and System File Checker Utility to repair your damaged Windows 11 image and installation.

What is DISM and Why Use It?

DISM, or Deployment Image Servicing and Management, is a Microsoft tool designed to service and repair Windows images, including the Windows Component Store, which contains critical system files. It’s particularly useful for fixing issues like:

  • Corrupted system files are causing errors or crashes.
  • Problems with Windows Updates failing to install.
  • Preparing or customizing Windows images for deployment.

DISM supports multiple specified commands to repair your Windows computer: DISM CheckHealth, DISM ScanHealth, and DISM RestoreHealth.

  • CheckHealth quickly verifies if an image has been flagged as corrupted, but doesn’t attempt repair.
  • ScanHealth performs a more thorough scan, checking for component store corruption and logging potential issues.
  • RestoreHealth automatically attempts to repair detected issues, using Windows Update or a local source if available.

How to Use DISM Commands

Follow these steps to use the DISM command line to repair a Windows image. We’ll cover both online and offline image repairs.

  • Press Win + S and type cmd. Right-click on Command Prompt and select Run as administrator.
  • Alternatively, use PowerShell by typing powershell in the search bar and selecting Run as administrator.
  • Click Yes if prompted by User Account Control.

Check the Health of the Windows Image

Run the DISM command DISM /Online /Cleanup-Image /CheckHealth to check the health of the Windows Component Store.

  • /Online: Targets the currently running Windows system.
  • /Cleanup-Image parameter specifies that the operation is related to Windows image repair.
  • /CheckHealth: Quickly checks for corruption in the Component Store.

DISM CheckHealth command

This command checks for any corruption in the image but does not attempt to repair it. It will return one of the following statuses:

  • Healthy – No corruption found.
  • Repairable – Corruption exists, but can be fixed.
  • Non-repairable – Severe corruption found; a clean OS reinstall may be necessary.

If checkhealth scan result, Repairable (It means, Corruption exists, but can be fixed) run the DISM /Online /Cleanup-Image /ScanHealth command.

/ScanHealth: Performs a deeper scan to identify corrupted components.

DISM ScanHealth command

This command thoroughly scans all protected system files and identifies any issues that need repair.

Repair the Windows Image

If corruption is detected, use the /RestoreHealth option to repair the Windows image. This command attempts to automatically download and replace the corrupted files from Windows Update.

DISM /Online /Cleanup-Image /RestoreHealth

/RestoreHealth: Repairs corrupted files by replacing them with healthy versions.

DISM RestoreHealth command

This process can take 15–30 minutes, depending on your system and internet speed. Also, ensure your system is connected to working internet as it uses Windows update as a source to download and replace the required files.

Using a Local Source for Repair

If the online repair fails (e.g., due to internet issues or severe corruption), you can use a Windows installation media as a source for repair files.

  • Download the appropriate Windows ISO from Microsoft’s official website.
  • Right-click the ISO file and select Mount to assign it a drive letter (e.g., D:).
  • Note the path to the install.wim or install.esd file (e.g., D:\sources\install.wim)

Now run the following command, replacing D:\sources\install.wim with your file’s path:

DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:1 /LimitAccess

  • /Source:WIM: Specifies the path to the Windows image file.
  • :1: Refers to the index of the Windows edition in the WIM file (e.g., Windows 10 Pro).
  • /LimitAccess: Prevents DISM from accessing Windows Update, forcing it to use the provided source.

dism restorehealth with Source options

Run System File Checker (SFC)

After repairing the Windows image, it’s a good idea to run the System File Checker (SFC) to ensure all system files are intact.

  • Again, open the command as Administrator and run sfc /scannow command.
  • /scannow: Scans and repairs corrupted system files using the repaired Component Store.

system file checker windows 11

Let the scanning complete 100%, once done, reboot your PC and check if your PC is running smoothly.

Common DISM Errors and How to Fix Them

Error 0x800f081f (Source Files Not Found) : Ensure you have a valid Windows installation media with the correct version and edition. Verify the path to the install.wim or install.esd file. In addition, check your internet connection for online repairs.

DISM Command Fails: Run Command Prompt as an administrator. Ensure the Windows image matches your system’s version (e.g., Windows 10 or 11).

DISM Stuck at 20%, 40%, 62%, etc: Repairs may take time, especially with offline images or large WIM files. Be patient and avoid interrupting the process.

Kelvin smith

I am Kelvin Smith, founder of TechAIThreads. I have completed a Bachelor of Arts (BA) and am a Microsoft Certified Professional (MCP). With a strong background in computer applications, I love writing practical guides on Microsoft Windows (11, 10, etc.), Android, cybersecurity, WordPress, and more.