If the system files in your Windows 10 computer become corrupt and the System File Checker (
SFC /scannow) is unable to reinstate the critical system files, it’s due to corruption of the Component Store located at the
C:\Windows\WinSxS directory. This directory contains the files needed for SFC utility to restore missing or damaged system files. The Component store stores all the Windows system files grouped by components and as hard links.
This post tells you how to fix Windows 10 if some system files or the component store are damaged.
There is a console tool named
DISM (Deployment Image Servicing and Management) which ships with Windows. DISM is used to fix Windows Component Store corruption, especially in situations where the System File Checker doesn’t help.
The DISM tool writes the following log files which can be used to analyze the operation status and errors:
Repair Windows 10 Using DISM
To repair Windows 10 using DISM, use the following steps:
Step 1: Check for component store corruption
Open an elevated command prompt and type the following command and press Enter:
Dism /Online /Cleanup-Image /CheckHealth
/CheckHealth is used to check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired. Note that this command doesn’t scan the files or fix anything; it only reports if there are any corruptions marked already.
Instead, to do a thorough check, then run DISM with the
/ScanHealth parameter as mentioned below to check the component store for corruption. It scans for all files and verifies the hash values.
Dism /Online /Cleanup-Image /ScanHealth
It takes a significantly more extended amount of time than the CheckHealth option, but using this switch may be doing a thorough test, and also writes the results to the
CheckHealth command-line argument, as said earlier, reports if there is any corruption if already marked in the registry. It doesn’t scan the files. This parameter also reports if the component store corruption can be repaired or not.
If the following registry value is set, then the tool will report that the component store is corrupted:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing DWORD Value name: Unserviceable Data: 0 or 1 DWORD Value name: Corrupt Data: 0 or 1
Unserviceable is set to
1, then running DISM with
/checkhealth parameter would report
The component store cannot be repaired.
Corrupt is set to
Unserviceable is set to
0, DISM checkhealth would report
The component store is repairable.
The ScanHealth command-line, on the other hand, doesn’t rely on the previously marked data. It would rather scan each file in the
WinSxS directory and sub-directories, verify their hashes. It then reports if the component store is corrupted or healthy.
If the ScanHealth command-line finds the component store is healthy, it removes the
unserviceable values in the registry automatically, thereby marking the component store as healthy. The operations are logged on to the file
Note: The DISM CheckHealth command-line completed in less than 10 seconds. Whereas, the ScanHealth command-line took 13 minutes to complete on my computer.
Step 2: Repair the component store
scanhealth command-line reports of any corruption (and if it’s repairable), run the following command to repair the component store:
Dism /Online /Cleanup-Image /RestoreHealth
When you run this command, DISM uses Windows Update to provide the files that are required to fix corruptions. The command scans for component store corruption and does the repair operations automatically, writing the operational results to
dism.log files. This process takes a long time to complete.
DISM RestoreHealth command fails to complete?
In some cases, the
RestoreHealth command-line fails to run due to unserviceable or corrupt image error (e.g., if your Windows Update client is already broken on the computer, DISM can’t fetch the missing files via the WU channel). Here are a couple of error codes that you may encounter:
Error: 14098 (0x80073712) ERROR_SXS_COMPONENT_STORE_CORRUPT The component store is in an inconsistent state. The component store has been corrupted. 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.
In those cases, you need to mention the WIM file as the source from which you can restore corrupted system files.
Follow the instructions in the article to run the RestoreHealth operation mentioning the source location (slipstreamed Windows 10 disk). For more information, check out the article DISM Error 0x800f081f During RestoreHealth in Windows 10
You’d use this syntax in that case:
Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:Full Path to install.wim file:<Index>
Replace the <Index> placeholder in the above command with the actual index number for the Edition (“Home”, “Pro” etc) contained in the WIM file.
Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\Sources\install.wim:1
You can list available editions and their indexes with the following command:
dism /get-wiminfo /wimfile:F:\sources\install.wim
(Replace the F:\sources\ portion with the actual path to your WIM file.)
For more information, see the article Find the Windows version, build and edition from ISO or DVD
Step 3: Run the System File Checker
After you fix the component store corruption (if any), follow up with the System File Checker to restore the critical system files.
Run the following command from an elevated command prompt:
For more information, refer Microsoft articles Use the System File Checker tool to repair missing or corrupted system files and How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program generates
Hope that helps repair the component store and restore the Windows system files.
One small request: If you liked this post, please share this?One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
About the author
Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.