Understanding the Purpose of DISM /ScanHealth and DISM /RestoreHealth Commands

The Deployment Image Servicing and Management (DISM) tool is a powerful utility in Windows used to repair the Windows image, particularly when system files become corrupted or damaged. Two important DISM commands are:

  1. DISM.exe /Online /Cleanup-Image /ScanHealth
  2. DISM.exe /Online /Cleanup-Image /RestoreHealth

Both commands play a crucial role in identifying and resolving corruption in the Windows system image, but they serve different purposes in the repair process.

1. DISM.exe /Online /Cleanup-Image /ScanHealth

  • Purpose:
    The /ScanHealth command is used to scan the Windows image for corruption or damage. It performs a thorough inspection of the system image to determine if any components are corrupted.

  • How it Works:
    This command checks the health of the Windows component store and logs any issues it finds. However, it does not make any repairs; it only diagnoses the problem. If this command finds corruption, the next step is to use /RestoreHealth to repair it.

  • When to Use:
    Run this command when you suspect system corruption but want to check the integrity of your system image without making immediate repairs. It’s often the first step in diagnosing system issues.

2. DISM.exe /Online /Cleanup-Image /RestoreHealth

  • Purpose:
    The /RestoreHealth command repairs the Windows image. It not only scans the system for issues but also attempts to automatically fix any detected corruption. If the local repair image is damaged, it downloads the necessary files from Windows Update to restore the health of the image.

  • How it Works:
    The command checks the health of the Windows image and fixes corruption by replacing the corrupted files with healthy ones from Windows Update or another source.

  • When to Use:
    After diagnosing issues with /ScanHealth, use /RestoreHealth to fix those issues. It’s useful when you’ve confirmed system corruption or other issues that affect Windows components.

Relation Between /ScanHealth and /RestoreHealth

  • The /ScanHealth command is diagnostic, meaning it only checks for issues and logs them without attempting repairs. Think of it as a preliminary check.
  • The /RestoreHealth command is corrective, meaning it not only scans but also repairs any issues it detects. This command is typically used after /ScanHealth finds corruption.

Thus, the workflow is often:

  1. Run /ScanHealth to check for corruption.
  2. Run /RestoreHealth to repair any corruption found.

Steps to Run the Commands:

  1. Open Command Prompt as Administrator:

    • Right-click the Start button and choose Command Prompt (Admin) or Windows Terminal (Admin).
  2. Run /ScanHealth:

    cmd
    Copy code
    DISM.exe /Online /Cleanup-Image /ScanHealth
    • This command will take some time to complete as it scans the system for any issues.
  3. Run /RestoreHealth:

    cmd
    Copy code
    DISM.exe /Online /Cleanup-Image /RestoreHealth
    • This command can take several minutes to repair the system image.