Jump to content

Using SFC and DISM to correct file corruption

Recommended Posts

  • Root Admin

Using SFC and DISM to correct file corruption

Quick Entry:


    if success, you're done. 
    if error, run DISM command

DISM.exe /Online /Cleanup-image /Restorehealth

    if error, see below for more details on running DISM 


What is SFC
System File Checker - Use the System File Checker tool to repair missing or corrupted system files

What is DISM
Deployment Image Servicing and Management (DISM.exe) is a command-line tool that can be used to service and prepare Windows images.
DISM can be used to mount and service a Windows image from a .wim file, .ffu file, .vhd file, or a .vhdx file and also to update a running operating system.
It can be used with older Windows image files (.wim files). However, it cannot be used with Windows images that are more recent than the installed version of DISM
DISM comes built into Windows and is available through the command line or from Windows PowerShell.


Normally one needs to run SFC.exe /SCANNOW from an elevated admin command prompt first, to locate and correct corrupt operating system files
However, in some cases, the program is unable to correct damage because it doesn't have access to good, trusted versions of the operating system files.

In those cases, it is often due to some type of corruption and you can use the DISM utility to check and repair
Once DISM has run correctly and repaired the files you would then run SFC again

The normal operations for repair using DISM are as follows and would be issued from an elevated admin command prompt

  • DISM.exe /Online /Cleanup-Image /CheckHealth (runs very quickly - scans logs for issues)
  • DISM.exe /Online /Cleanup-Image /ScanHealth (takes longer to run as it scans items in the component store and calculates and matches hash values)
  • DISM.exe /Online /Cleanup-image /Restorehealth (repairs the image store)


To start an elevated admin command prompt - click on the Start Menu and type in CMD 
Once it shows on the menu right-click and select "Run as administrator"



Inside the elevated admin command prompt type in the following and press the Enter key and SFC will scan and analyze the system and attempt to correct system issues.    



There are generally two answers you want to see. That it found and fixed issues or that it did not find any issues.

Here are a couple of examples of expected results





If instead, you get a message from SFC like this: "Windows Resource Protection found corrupt files but was unable to fix some of them", that indicates you should then run DISM to repair items.

In most cases, users bypass the CheckHealth and ScanHealth options and go directly to the Restorehealth command from the elevated admin command prompt 

Type in or copy / paste the following command and press the Enter key  

DISM.exe /Online /Cleanup-image /Restorehealth 

The Restorehealth command does not provide details of what it did, it usually either says it ran successful or returns an error  

Here is an example of the DISM Restorehealth command running with a success message


Here is an example of one type of error you might see.

Error: 0x800f081f

The source files could not be found. 
Use the "Source" option to specify the location of the files that are required to restore the feature.

There are other errors and other possible workaround depending on what the error is. For errors where the files cannot be found it is probably best to download a Windows 10 .iso installation file.
That can be used to mount and run locally as a specified source


Visit the following link and download the Microsoft Media Creation Tool



Agree to the EULA - End User License Agreement
Do not select Upgrade this PC now - instead change it to Create installaltion media (USB flash drive, DVD, or ISO file) for another PC


Choose the ISO file


Do not open or choose Burn to DVD - click the Finish button



SIDE NOTE: For those with 7-zip you can open the Windows.iso image and extract the install.esd file to the c:\iso folder all in one step if wanted.


Open File Explorer and create a new folder C:\iso
(you can run the file where it's at in your downloads folder but most users have hundreds of files in the downloads folder and it may be difficult to manage from there)
Using C:\iso will be easier on the command line too.




Now go find the WINDOWS.ISO image you downloaded and cut and paste or move it to the c:\iso folder

After you move the file to the c:\iso folder then highlight it and right-click and select Mount
This will automatically pick the next available drive letter and open the ISO image.
For most users, this will probably be the E: or F: drive but could be higher drive letters


Once the file has been mounted then open that drive and browse to the Sources folder and locate the file INSTALL.ESD
Copy the install.esd file to the c:\iso folder as well


Once you've copied the install.esd file to the c:\iso folder you can right-click the mounted ISO image and select Eject to unmount it


Now, open an elevated admin command prompt again and copy / paste the following entry and then press the Enter key. We need to find the Index number that matches your Windows type
Pay attention to your version of Windows if it's Home, Pro, Education, etc. as you'll need to use the same type

Dism /Get-WimInfo /WimFile:c:\iso\install.esd 



You can type in Winver from the command line or from the Start Menu and it will tell you what type of Windows you're running
In my case I'm running Windows 10 Pro, but your type may be something else.



From the elevated admin command prompt copy / paste the following command which will convert the install.esd file to install.wim

Dism /export-image /SourceImageFile:c:\iso\install.esd /SourceIndex:6 /DestinationImageFile:c:\iso\install.wim /Compress:max /CheckIntegrity

NOTE: Make sure you change the /SourceIndex:6 to match your type of Windows

C:\ISO>Dism /Get-WimInfo /WimFile:c:\iso\install.esd

Deployment Image Servicing and Management tool
Version: 10.0.19041.844

Details for image : c:\iso\install.esd

Index : 1
Name : Windows 10 Home
Description : Windows 10 Home
Size : 15,489,142,996 bytes

Index : 2
Name : Windows 10 Home N
Description : Windows 10 Home N
Size : 14,716,766,977 bytes

Index : 3
Name : Windows 10 Home Single Language
Description : Windows 10 Home Single Language
Size : 15,470,244,213 bytes

Index : 4
Name : Windows 10 Education
Description : Windows 10 Education
Size : 15,722,347,443 bytes

Index : 5
Name : Windows 10 Education N
Description : Windows 10 Education N
Size : 14,953,374,712 bytes

Index : 6
Name : Windows 10 Pro
Description : Windows 10 Pro
Size : 15,720,710,878 bytes

Index : 7
Name : Windows 10 Pro N
Description : Windows 10 Pro N
Size : 14,955,666,348 bytes

Once that command completes you should now have the following files in the c:\iso folder

  • install.esd
  • install.wim
  • Windows.iso



Now we need to verify that the install.wim contains the Windows type that matches our Windows. Run the following from the elevated admin command prompt   


Dism /Get-WimInfo /WimFile:c:\iso\install.wim 

Make sure YOUR version of Windows is shown and not this example



With the file type now matching, we'll use the following command to run DISM and repair the system

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



Now it's time to run SFC again to have it fix and repair any file corruption it was unable to correct before

Run the following from the elevated admin command prompt



At this point hopefully, both SFC and DISM have now run correctly and were able to repair your system files.

It may be a good time to also go ahead and run a disk check on your system drive to verify the integrity of files, folders, etc.

Run the following from the elevated admin command prompt and restart the computer to allow the disk check to run







Edited by AdvancedSetup
updated information
  • Thanks 4
Link to post
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
Back to top
  • Create New...

Important Information

This site uses cookies - We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.