# Sticky  Using the SFC and DISM to Repair Windows 10



## britekguy

*Note:* The SFC utility has been available for many years. DISM came on the scene with Windows 8.

What follows is downloadable from: Using SFC (System File Checker) and DISM (Deployment Imaging Servicing and Management) to Repair Windows 8 & 10
----------------------------------------------------------------------------------------------------

*Fixing "Weird Issues" under Windows 8 or Windows 10 Using the System File Checker (SFC) and Deployment Imaging Servicing and Management (DISM)*

Note: Both SFC and DISM *must* be run with administrator privileges in order to do their work. They can be run either from PowerShell or from Command Prompt, but whichever you use it must be invoked with the "Run as Administrator" option.

1. To open a *PowerShell* session using the "Run as Administrator" option (note: PowerShell is a bit slower about opening up and being ready to go than Command Prompt is, but it's easier to invoke):

a. Hit the Windows Key + X, followed by A

b. You will then get a prompt from User Account Control asking whether you wish to allow this program to make changes to your computer, and you will answer with, "Yes."

c. The PowerShell window with administrator privilege will open with the window frame label, *Administrator: Windows PowerShell*

2. To open a *Command Prompt* window using the "Run as Administrator" option:

a. Hit the Windows Key then immediately start typing "Command Prompt." Usually just the "Command" part is enough. You will then almost certainly have the Command Prompt desktop app returned as the first item in the search results.

b. Gain focus on it and bring up the context menu either via right click or hitting the menu/applications key (if your machine has one) or SHIFT + F10 if it does not.

c. Select "Run as administrator" from the context menu that appears. You will then get a prompt from User Account Control asking whether you wish to allow this program to make changes to your computer, and you will answer with, "Yes."

d. The Command Prompt window with administrator privilege will open with the window frame label, *Administrator: Command Prompt*

If you are having "weird problems" with any Windows system, the first thing you should do is to run the System File Checker (SFC). In the elevated Command Prompt or PowerShell window, enter this command:

*SFC /scannow*

When it's finished look at its output to see if it found any corrupt files and whether it was able to fix them. It will tell you if it has found and fixed things, or found some and was unable to fix them.

If SFC reports that it was unable to fix something on Windows 8 and Windows 10 systems it's also worth running the following command:

*DISM /Online /Cleanup-Image /RestoreHealth*

DISM should be able to fix errors that SFC may not be able to fix. You can run it even if SFC comes back clean if you wish, as that will not hurt anything and it might find something SFC does not. If you want to be _really_ thorough, after running DISM, and presuming it reports that all has been fixed, shutdown and restart your machine and run SFC one final time. The SFC result should be clean. Typically, you will be done at this point. If the DISM fails to run or correct your issue, proceed below.


*If the above DISM does not fix your problem, or reports an error such that it cannot run, do the following. Do NOT take the following steps unless you have issues with the DISM command above. This should almost never be necessary. Personally, I'd be inclined to Do a Repair Install of Windows 10 as opposed to what follows; it's actually easier.*

Download the media creation tool from the *Microsoft Windows 10 Download Page*

Use the option to create media for installing on another computer, and choose the ISO option so that you will have the ISO file at the end. You will choose where it is to be saved and you can assign the name yourself to make it easier to remember

In File Explorer, navigate to the folder containing the ISO file. Select the ISO, bring up the context menu using right click or SHIFT + F10, and choose Mount from the context menu.

In the File Explorer that comes up for the mounted ISO, find the _sources_ folder, then open it.

Locate the file named _install.esd_, select it, then hit CTRL + C to copy it to the system clipboard. Navigate to the root of the C: drive, create a new folder called _MediaInstallESD_, open it and then hit CTRL + V to paste it there from the clipboard.

Next, you will need to find the correct windows version from the install.esd by looking at the Names associated with the Index Numbers. In a Command Prompt or Power Shell _opened elevated with admin privileges_, enter the following commands, hitting the Enter key after typing each (it may be easier to copy each and paste it in to the session):

*CD* c:\mediainstallESD

*DISM* /Get-WimInfo /WimFile:install.esd

In the output of the DISM command, search for the Index number that matches the Name of the edition running on the machine you're working on. The most common are:

1 Home

6 Pro

4 Education

Next, you will convert the install.esd file into a WIM file, install.wim, copying the DISM command below, changing the value noted by *?* to the index number that corresponds to the version of Windows 10 on the system you're working on, then hitting Enter. This is the _ONLY ONE_, of all the commands presented, that requires you to change something:

*DISM* /export-image /SourceImageFile:C:\MediaInstallESD\install.esd /SourceIndex:*?* /DestinationImageFile:install.wim /Compress:max /CheckIntegrity

Next you are going to switch back to the root of the C: drive by using the command:

*CD* c:\

Next, you will run a series of 3 DISM commands, hitting the Enter key after each, and waiting for each to complete before starting the next. These can take a while to run, so be patient. I suggest copying each and pasting it into your Comand Prompt or Power Shell session:

*DISM* /Online /Cleanup-Image /StartComponentCleanup

*DISM* /Online /Cleanup-Image /AnalyzeComponentStore

*DISM* /Online /Cleanup-Image /RestoreHealth /Source:WIM:C:\MediaInstallESD\install.wim:1 /LimitAccess


 DISM shows a progress indicator and should complete with a success message.


----------

