Use DISM to fix issues SFC can't

A common suggestion on Windows support forums is to scan the system for file integrity issues using the command sfc /scannow which you may run on the active system but also on external drives.

SFC, which stands for System File Checker, is a built-in administrative tool to verify the integrity of operating system files and to repair files that are corrupt, damaged or changed.

SFC scans have three possible outcomes:

  1. The scan did not find any issues.
  2. The scan did find issues and fixed them.
  3. The scan did find issues and couldn't repair them (Windows Resource Protection found corrupt files but was unable to fix some of them).

Note: It is recommended that you do a full backup of the Windows system partition before you run DISM. Use free backup solutions such as Macrium Reflect, Veeam Endpoint Backup, or other backup tools.

ADVERTISEMENT

Use DISM if SFC /Scannow fails to correct issues

sfc scannow

The screenshot displayed above shows a result where SFC was unable to correct corrupt files that it detected.

SFC may also correct issues but it may not resolve the issue that you tried to correct in first place by running it.

DISM comes to the rescue in these situations. Deployment Image Servicing and Management (DISM)  is a command line program for Windows that is used for a variety of purposes.It is available in all versions of Windows starting with Windows 7 and Windows Server 2008

You need to run DISM from an elevated command prompt:

  1. Tap on the Windows-key to bring up the start menu.
  2. Type cmd.exe and wait for the results to populate.
  3. Right-click on the result named cmd.exe and select "run as administrator" to run it with elevated privileges.

DISM can be run in dry-mode to reveal corruption without attempting to fix issues found. I recommend that you check the health first to find out if corruption exists before you run repair operations.

Dism /Online /Cleanup-Image /CheckHealth

dism checkhealth

The command checks the image for the corruption flag and returns its findings to you but does not run repair operations.

The scan should not take longer than a second or two. Previous operations may have flagged the image as corrupt.

Dism /Online /Cleanup-Image /ScanHealth

dism scanhealth

The command scans for component store corruption but does not correct any issues.

The scan takes longer to complete and the findings of the scan are returned in the command prompt window.

DISM /Online /Cleanup-Image /RestoreHealth

dism restorehealth

The /RestoreHealth parameter runs a scan for corruption and attempts to repair any issues that it finds automatically.

The scan takes longer to complete if corruption is found during the scan of the image. Note that the operation may appear stuck at times but this is no cause for concern as scanning should commence after a moment automatically.

If the scan finds corruption, it attempts to correct the issue using Windows Update by default.

DISM Advanced commands

  • To repair an offline image: Dism /Image:C:\offline /Cleanup-Image /RestoreHealth
  • To use a different repair source: Dism /Online /Cleanup-Image /RestoreHealth /Source:d:\test\mount\windows
  • To prevent the use of Windows Update:  /LimitAccess as a parameter.

Group Policy

You can specify a different source using the Group Policy.

dism repair policy

Do the following for that:

  1. Tap on the Windows-key to bring up the start menu.
  2. Type gpedit.msc and hit the Enter-key to open the Group Policy Editor. Note that it is only available in professional or Enterprise editions of Windows.
  3. Go to Computer Configuration > Administrative Templates > System.
  4. Double-click on Specify settings for optional component installation and component repair.
  5. Set the policy to enabled, and configure it accordingly.
  6. You need to specify an alternate source, and may block use of Windows Update. Systems configured to use WSUS by default may be configured to use Windows Update instead for repair operations.

Dism using PowerShell

You may use DISM in Windows PowerShell as well. The commands are slightly different.

  • CheckHealth: Repair-WindowsImage -CheckHealth
  • ScanHealth: Repair-WindowsImage -ScanHealth
  • RestoreHealth: Repair-WindowsImage -RestoreHealth

DISM Instructional Video

Related articles

Summary
Use DISM to fix issues SFC can't
Article Name
Use DISM to fix issues SFC can't
Description
How to use the DISM command line tool to repair Windows operating system issues if SFC /scannow does not resolve them.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Franck said on March 16, 2018 at 11:25 am
    Reply

    Thanks a lot for the info ! There is a great app with GUI : Dism++

  2. cic said on March 16, 2018 at 1:30 pm
    Reply

    Although Dism command exists on Windows7 it doesn’t work with those options, maybe someone could explains how to repair on Win7?

    1. B0BoB said on March 16, 2018 at 1:44 pm
      Reply

      Simple, Use DISM++

      1. Jody Thornton said on March 16, 2018 at 3:45 pm
        Reply

        Yes but DISM++ is limited by the capabilities of the OS. I’ve tried removing superseded components on Windows 8 (the same as you can with Windows 8.1), but it won’t perform tasks that the OS version can’t support.

      2. ilev said on March 19, 2018 at 8:33 pm
        Reply

        DISM++ in no more than a CCleaner and can’t perform any of DISM features.

    2. Mike said on March 20, 2018 at 11:58 am
      Reply

      Download Windows ADK to get an up-to-date DISM tool:
      https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install

      Please note some DISM repair options are not available on older OS (ie Win7), it won’t harm your OS though :)

  3. Mark Hazard said on March 16, 2018 at 2:14 pm
    Reply

    Thanks for the article Martin. I wondered what DISM was for.

  4. Andy said on March 16, 2018 at 4:25 pm
    Reply

    Great article. Sfc is almost useless now days it seems. I will remember to try this mor often.

  5. Microfix said on March 17, 2018 at 1:10 pm
    Reply

    Martin,
    SFC stands for System File Checker not ‘System File Scan’ as per the article description. One point deducted from each reader who never noticed and one from the author :)

    I prefer to use:
    sfc/ verifyonly
    prior to using the scannow switch.
    (which notifies the user of errors but, does not correct them, so I can investigate further.)

    1. Martin Brinkmann said on March 17, 2018 at 4:35 pm
      Reply

      You are right of course, sorry for that. Fixed it!

      1. Microfix said on March 17, 2018 at 4:56 pm
        Reply

        Nice to keep things correct to uphold your reputation.
        Many thanks for the article :)

      2. Omid Heydarzadeh said on January 25, 2020 at 7:31 am
        Reply

        Martin thanks for the article please fix DISM commands mentioned in it. it seems that they need to be like this:

        CheckHealth: Repair-WindowsImage -Online -CheckHealth

        ScanHealth: Repair-WindowsImage -Online -ScanHealth

        RestoreHealth: Repair-WindowsImage -Online -RestoreHealth

  6. OldNavyGuy said on March 20, 2018 at 1:51 am
    Reply

    Sysnative’s SFCFix is a good alternative, and fixes some things SFC and DISM cannot…

    https://www.sysnative.com/forums/windows-update/4736-windows-update-forum-posting-instructions.html

    Expand Step 4 for the download link.

  7. Sam said on October 24, 2018 at 4:28 am
    Reply

    Hello,

    Is it possible to schedule SFC & DISM tasks to be performed on a regular basis as a preventative way? How is ADK compare to SFC/DISM ?

    Thank you

  8. Yash Makwana said on November 6, 2018 at 3:59 pm
    Reply

    i got a problem as error 1117 while dism scan health comand

  9. SoulSnatcher said on July 23, 2019 at 7:00 pm
    Reply

    You’re partially wrong about running DISM commands in Powershell (at least for windows 8.1)… Yes you can do it, but you just use the same commands as you do in Command Prompt, I tried using the commands you listed for Powershell and it just came back with errors every time however, when I used the Command Prompt commands it ran fine.

  10. jerswing said on January 14, 2020 at 10:50 pm
    Reply

    “the checkhealth option is not recognized in this context.”

  11. Andrew Rowland said on November 27, 2020 at 7:38 pm
    Reply

    I am struggling to use DISM in any meaningful way, which is no doubt due to my lack of understanding — or misunderstandings.

    Background of the current problem — though my questions are general:

    I have the harddrive from a computer that will not boot up but can get into the recovery environment (or I can boot off a Windows 10 installation memory stick).

    I have performed bootrec /fixmbr (which reports successful), bootrec /fixboot (which reports Access Denied) and bootrec /ScanOS which reports no Windows installations found, although the Windows partition and folder can be accessed just fine. I ran
    bcdboot C:\Windows /s S:
    where the OS partition had been assigned the letter C: and the 100MB FAT32 partition S:

    As a result of that, it now boots as far as a stopcode 0xc000021a, which could be due to corruption of WinLogon or Client Server-Run Time Subsystem (CSRSS) or of a driver, so I am trying to check the install for integrity.

    I have removed the hard drive and stuck it in my PC. The Windows partition is mounted as H:
    sfc offline scan says ‘Windows Resource Protection could not perform the requested operation’. Chdsk /r says no issues found.

    My questions are:
    1. Is the ‘guest’ hard drive offline as far as DISM is concerned? In my head, the definition of ‘online’ is the Windows installation that is currently running (my own PC in this case) and ‘offline’ is everything else — but am I right?
    I base that assumption in part on the fact that if you use the /online switch, there is no way to specify where the affected Windows folder is, so it uses C:\
    * I am aware that there are files that IT departments use to re-image their PCs and that they can modify those images, but that is NOT what I am doing: I am trying to repair a windows installation.

    2. How do you tell DISM where Windows is? I tried
    DISM /Image:H:\windows /Cleanup-Image /RestoreHealth and it says:

    Error: 2
    Unable to access the image.
    Make sure that the image path and the Windows directory for the image exist and you have Read permissions on the folder.

    – I do have Read permission for H:\Windows and can read files in the WinSXS folder.

    * I wonder about that bit about Read permissions. Wouldn’t it need Write? Or is it referring to my own Windows folder there?

    I also tried just H:\ instead of H:\Windows (same error),
    Dism /Image:H:\offline /Cleanup-Image /RestoreHealth (same) and tried
    Dism /Image:H:\windows /Cleanup-Image /RestoreHealth /Source:c:\windows
    with the same error.
    The only thing that gave a different error was
    Dism /Image:H:\ /Cleanup-Image /RestoreHealth /Source:c:\windows
    That backslash after the H: meant it said
    Error: 87
    The cleanup-image option is unknown.

    Dism /Image:H: /windir:H:\windows /Cleanup-Image /RestoreHealth gives
    Error: 123
    Unable to access the image.

    3. The documentation says that the source for DISM must match the installation in version and language. My PC is on Win10 2004, but I do not know which version the broken install is. How can you tell, given that you cannot start it up?

    Grateful for any help. Thanks.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.