What is the correct order of DISM and sfc commands to fix problems?

Page 1 of 5 123 ... LastLast

  1. Posts : 173
    Windows 10 Home, 22H2
       #1

    What is the correct order of DISM and sfc commands to fix problems?


    Today i updated my system to build 2004.
    Everything went fine and so far i haven't had any problems.

    For good meassure i ran sfc /verifyonly and it found some problems.

    From reading here in the forum and from this Microsoft support document, it is recommended first to run

    DISM.exe /Online /Cleanup-image /Restorehealth
    and then
    sfc /scannow

    Here in the forum i found this thread where it is recommended to run DISM and sfc in this order:

    1) Dism.exe /online /Cleanup-Image /checkhealth
    2) Dism.exe /online /Cleanup-Image /scanhealth
    3) Dism.exe /online /Cleanup-Image /Restorehealth
    4) sfc /scannow
    5) Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
    6) Dism.exe /Online /Cleanup-Image /StartComponentCleanup

    I seem to remember that i have seen other recommendations elsewhere (can't remember where).

    So i was wondering: Is there a consensus on the correct order of DISM and sfc commands to to repair missing or corrupted system files?
      My Computer


  2. Posts : 1,862
    Windows 10 Pro 2004 20H1
       #2

    I usually run SFC first.

    If I want to see what it found -

    In an elevated Command prompt (Run as administrator), copy/paste the following, and press Enter...

    findstr /c:"[SR]" %windir%\logs\cbs\cbs.log > "%userprofile%\Desktop\sfcdetails.txt"

    This will create a file on your Desktop called sfcdetails.txt
      My Computer


  3. Posts : 13,301
    Windows 10 Pro (x64) 21H2 19044.1526
       #3

    Mine

    1. sfc /scannow
    2. Dism.exe /Online /Cleanup-Image /RestoreHealth
    3. Dism.exe /online /Cleanup-Image /StartComponentCleanup.

    analyzing scan health are only useful if you want a lot of details.
    Both dism an sfc will tell you of any problems.
    If you suspect a problem why analyze it and waste more time that you could use fixing
    them.
      My Computers


  4. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
       #4

    Hello Damun,

    Usually, you would only need to run the SFC /SCANNOW command to try and fix corrupted or modified system files.

    The Dism /Online /Cleanup-Image /RestoreHealth command is only needed to repair the component store that SFC uses to repair the system files from when SFC gives you an error about this.
      My Computers


  5. Posts : 173
    Windows 10 Home, 22H2
    Thread Starter
       #5

    Brink said:
    Hello Damun,

    Usually, you would only need to run the SFC /SCANNOW command to try and fix corrupted or modified system files.

    The Dism /Online /Cleanup-Image /RestoreHealth command is only needed to repair the component store that SFC uses to repair the system files from when SFC gives you an error about this.
    Hello @Brink,
    If i understand you correctly SFC uses the component store as a base-line to "compare" and repair system files, right?
    Isn't it good meassure then to check if the component store is OK before doing a repair?
      My Computer


  6. Posts : 41,472
    windows 10 professional version 1607 build 14393.969 64 bit
       #6

    Running scannow first allows you to quickly see if there were integrity violations.

    Running the dism commands first typically results in scannow displaying no integrity violations found.

    If knowing whether there was an integrity violation to possibly explain problems then run scannow before and after the dism commands.
    If only the end result is important then run the dism commands before scannow.
    This checks and fixes problem with the protected parts of the Windows operating system and the component store.

    These commands only need to be run if you encounter or anticipate problems with restorehealth and need to increase free space:
    1) Dism.exe /online /Cleanup-Image /checkhealth
    2) Dism.exe /online /Cleanup-Image /scanhealth
    5) Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
    6) Dism.exe /Online /Cleanup-Image /StartComponentCleanup

    There is little if any downside running all of the commands (perhaps time).

    If there are problems running any of the above commands they typically can be fixed by performing an in place upgrade repair:
    Repair Install Windows 10 with an In-place Upgrade


    What problems did sfc detect after the upgrade?

    1) Open administrative command prompt and type or copy and paste:
    2) sfc /scannow
    3) dism /online /cleanup-image /scanhealth
    4) dism /online /cleanup-image /restorehealth
    5) sfc /scannow

    6) When these have completed > right click on the top bar or title bar of the administrative command prompt box > left click on edit then select all > right click on the top bar again > left click on edit then copy > paste into the thread
      My Computer


  7. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
       #7

    Damun said:
    Hello @Brink,
    If i understand you correctly SFC uses the component store as a base-line to "compare" and repair system files, right?
    Isn't it good meassure then to check if the component store is OK before doing a repair?
    Correct.

    It just depends on if you have the time to run DISM before SFC or not.

    Usually, you can save time by only running SFC unless the component store for SFC needed to be repaired by DISM first.
      My Computers


  8. Posts : 173
    Windows 10 Home, 22H2
    Thread Starter
       #8

    zbook said:
    Running scannow first allows you to quickly see if there were integrity violations.

    Running the dism commands first typically results in scannow displaying no integrity violations found.

    If knowing whether there was an integrity violation to possibly explain problems then run scannow before and after the dism commands.
    If only the end result is important then run the dism commands before scannow.
    This checks and fixes problem with the protected parts of the Windows operating system and the component store.

    These commands only need to be run if you encounter or anticipate problems with restorehealth and need to increase free space:
    1) Dism.exe /online /Cleanup-Image /checkhealth
    2) Dism.exe /online /Cleanup-Image /scanhealth
    5) Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
    6) Dism.exe /Online /Cleanup-Image /StartComponentCleanup

    There is little if any downside running all of the commands (perhaps time).

    If there are problems running any of the above commands they typically can be fixed by performing an in place upgrade repair:
    Repair Install Windows 10 with an In-place Upgrade


    What problems did sfc detect after the upgrade?

    1) Open administrative command prompt and type or copy and paste:
    2) sfc /scannow
    3) dism /online /cleanup-image /scanhealth
    4) dism /online /cleanup-image /restorehealth
    5) sfc /scannow

    6) When these have completed > right click on the top bar or title bar of the administrative command prompt box > left click on edit then select all > right click on the top bar again > left click on edit then copy > paste into the thread
    Thanks for your reply @zbook.

    I've allready repaired the system violations (I ran the commands in the order i wrote in post #1) so sfc /scannow does not find anymore violations now.
    When i ran sfc /scannow (point no. 4 in post #1) it did report that violations were found and successfully repaired though
    Is there a log file listing the errors found?

    - - - Updated - - -

    Brink said:
    Correct.

    It just depends on if you have the time to run DISM before SFC or not.

    Usually, you can save time by only running SFC unless the component store for SFC needed to be repaired by DISM first.
    But you wouldn't know if the component store is corrupted unless you check it, right?
    Luckily i only do this occasionaly so time is not really a problem for me...
      My Computer


  9. Posts : 41,472
    windows 10 professional version 1607 build 14393.969 64 bit
       #9

    See the findstr command posted by OldNavyGuy in post #2.

    Post a share link into this thread using one drive, drop box, or google drive


    Look for C:\Windows\Logs\CBS\CBS.log > post a share link into this thread


    Often hash mismatches can trigger the integrity violation.
    (This had happened with Microsoft defender in a prior Windows upgrade.)
    Typically there is no corruption after a successful upgrade.


    https://support.microsoft.com/en-us/...s-as-corrupted
      My Computer


  10. Posts : 173
    Windows 10 Home, 22H2
    Thread Starter
       #10

    zbook said:
    See the findstr command posted by OldNavyGuy in post #2.

    Post a share link into this thread using one drive, drop box, or google drive


    Look for C:\Windows\Logs\CBS\CBS.log > post a share link into this thread


    Often hash mismatches can trigger the integrity violation.
    (This had happened with Microsoft defender in a prior Windows upgrade.)
    Typically there is no corruption after a successful upgrade.


    https://support.microsoft.com/en-us/...s-as-corrupted
    Link to document on google drive here
    I am at the limit of what i know about this (i.e. this is beyond my understanding), so if you find anything please let me know.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:24.
Find Us




Windows 10 Forums