DISM - Fixing Component Store Corruption in Windows 8

How to Use DISM to Fix Component Store Corruption in Windows 8 and Windows Server 2012

One of the most used tools when fixing corruption for Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2 was the System Update and Readiness Tool (KB947821), commonly called CheckSUR. The CheckSUR tool was an excellent way for most people to see what corruption had happened on their store, and potentially fix that corruption if the tool contained the payload to do so.

In Windows 8/8.1 and Windows Server 2012, this has changed. It’s called Inbox Corruption Repair and it brings the functionality of CheckSUR into Windows rather than requiring a separate download to get the utility like you do now. This is exposed in two ways, the first is really unseen by the end user and happens when Windows detects a corrupted state when attempting to install fixes via Windows Update. When this happens, Windows fix the corruption silently and then re-install the prior packages. The manual way to use this tool is via DISM (Deployment Imaging and Servicing Management). The way this is exposed is via the DISM /Cleanup-Image functionality.

If a Windows image (Windows component store) becomes unserviceable, you can use the Deployment Imaging and Servicing Management (DISM) tool to update the files and correct the problem.

For example:

  • To use to fix Windows component store corruption when a SFC /SCANNOW command is unable to repair corrupted system files because the store (source) is corrupted, then run the SFC command again.
  • To use to fix Windows component store corruption when the same Windows Updates continue to appear to be available to install even though they already show successfully installed in update history.

For more information, see:



This tutorial will show you how to do an Inbox Corruption Repair with the DISM /Cleanup-Image tool to fix component store corruption in Windows 8 and Windows Server 2012.

You must be signed in as an administrator to be able to do an Inbox Corruption Repair with the Deployment Imaging and Servicing Management (DISM) tool.

Note   Note
The DISM /Cleanup-Image tool saves it's log files in the file locations below. To be able to view these logs, you would need to copy them from the locations below to your desktop, then open them from your desktop.

C:\Windows\Logs\CBS\CBS.log

C:\Windows\Logs\DISM\dism.log


CBS.log.jpg

DISM.log.jpg

Tip   Tip
If you get an error like below when running a DISM command in an option below, then run the command below and try again afterwards.

Dism.exe /online /Cleanup-Image /StartComponentCleanup


Note   Note
Error: 0x80240021

Failure DISM. No operation was performed.



CONTENTS:

  • Option One: To Run "DISM /Cleanup-Image" tool in an Elevated Command Prompt
  • Option Two: To Run "DISM /Cleanup-Image" tool in an Elevated PowerShell






OPTION ONE

To Run "DISM /Cleanup-Image" tool in an Elevated Command Prompt



1. Open an elevated command prompt.

2. Do step3, step 4, step 5, or step 6 below for what DISM command you would like to use.


3. To Use DISM /CheckHealth Command
Note   Note
You would use /CheckHealth to only check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired. This is just a quick way to see if corruption currently exists, and to inform you if there is corruption. This does not fix anything or create a log. This will finish running almost instantly.




A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:ar: Dism /Online /Cleanup-Image /CheckHealth

CMD_CheckHealth.jpg



4. To Use DISM /ScanHealth Command
Note   Note
You would use /ScanHealth to scan the image for component store corruption. This option does not fix any corruption. It only checks for component store corruption and records that corruption to the log file. This can take around 5-10 minutes to finish. It will stay at 20% for a while before continuing.





A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:ar: Dism /Online /Cleanup-Image /ScanHealth

CMD_ScanHealth.jpg



5. To Use DISM /RestoreHealth Command
Note   Note
(recommended) You would use /RestoreHealth to scan the image for component store corruption, perform repair operations automatically, and records that corruption to the log file. This can take around 10-15 minutes up to a few hours to finish depending on the level of corruption. It will stay at 20% for a while before continuing.





A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:ar: Dism /Online /Cleanup-Image /RestoreHealth

CMD_RestoreHealth.jpg



6. To Use DISM /RestoreHealth /Source:wim Command
Note   Note
You would use /Source with /RestoreHealth to specify the location of an install.wim file as the source of known good versions of files that can be used for the repair. This can take around 10-15 minutes up to a few hours to finish depending on the level of corruption. It will stay at 20% for a while before continuing.

This can be useful if step 5 above was not able to repair the Windows image (component store).


The install.wim file will be in the Sources folder of a mounted Windows 8.1 ISO file.





A) In the elevated command prompt, type the command below you want to use, press Enter, and go to step 7 below. (see screenshot below)

:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:Full Path to install.wim file:1

OR

(To prevent DISM from using Windows Update for online images)
:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:Full Path to install.wim file:1 /limitaccess

For example:

:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\sources\install.wim:1 /limitaccess

DISM_RestoreHealth_wim_sources.png



7. If you did step 5 or step 6 above, it is recommended to restart the computer to fully apply.






OPTION TWO

To Run "DISM /Cleanup-Image" tool in an Elevated PowerShell



1. Open an elevated PowerShell.

2. Do step3, step 4, step 5, or step 6 below for what DISM command you would like to use.


3. To Use DISM /CheckHealth Command
Note   Note
You would use /CheckHealth to only check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired. This is just a quick way to see if corruption currently exists, and to inform you if there is corruption. This does not fix anything or create a log. This will finish running almost instantly.




A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:arrow: Repair-WindowsImage /Cleanup-Image /CheckHealth

PowerShell_CheckHealth.jpg



4. To Use DISM /ScanHealth Command
Note   Note
You would use /ScanHealth to scan the image for component store corruption. This option does not fix any corruption. It only checks for component store corruption and records that corruption to the log file. This can take around 5-10 minutes to finish. It will stay at 20% for a while before continuing.




A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:arrow: Repair-WindowsImage /Cleanup-Image /ScanHealth

PowerShell_ScanHealth.jpg



5. To Use DISM /RestoreHealth Command
Note   Note
(recommended) You would use /RestoreHealth to scan the image for component store corruption, perform repair operations automatically, and records that corruption to the log file. This can take around 10-15 minutes up to a few hours to finish depending on the level of corruption. It will stay at 20% for a while before continuing.





A) In the elevated command prompt, copy and paste the command below, press Enter, and go to step 7 below. (see screenshot below)

:arrow: Repair-WindowsImage /Cleanup-Image /RestoreHealth

PowerShell_RestoreHealth.jpg



6. To Use DISM /RestoreHealth /Source:wim Command
Note   Note
You would use /Source with /RestoreHealth to specify the location of an install.wim file as the source of known good versions of files that can be used for the repair. This can take around 10-15 minutes up to a few hours to finish depending on the level of corruption. It will stay at 20% for a while before continuing.

This can be useful if step 5 above was not able to repair the Windows image (component store).


The install.wim file will be in the Sources folder of a mounted Windows 8.1 ISO file.





A) In the elevated command prompt, type the command below you want to use, press Enter, and go to step 7 below. (see screenshot below)

:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:Full Path to install.wim file:1

OR

(To prevent DISM from using Windows Update for online images)
:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:Full Path to install.wim file:1 /limitaccess

For example:

:ar: Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\sources\install.wim:1 /limitaccess

PowerShell_DISM_RestoreHealth_wim_sources.png



7. If you did step 5, step 6, or step 7 above, it is recommended to restart the computer to fully apply.





That's it,
Shawn


 

Attachments

  • Command_Prompt.png
    Command_Prompt.png
    3.4 KB · Views: 632
Last edited by a moderator:
It sounds like something may have interfered with DISM.

Is everything working properly now though?

Well from what I can see everything was working fine before I did the DISM and all appears ok now as well.

The reason I tried running the DISM command is that on a couple of occasions "Disk Cleaner" seems to get stuck in the midst of cleaning out the updates after I have installed them. It detects a large amount of space to delete, starts the deletion process then just hangs about 2/3 of the way through. I stumbled on another thread here, where one of the users ran the DISM to correct this so I thought I may see what this DISM was all about and decided to give it ago, hence the reason I am in this thread.

What do you think I should do? Try again or leave it be?

Forgot to mention, its a newly installed system, with just basically the drivers and whatever DELL has installed from factory [its a DELL system]. I have yet to install anything other than CCleaner & Geek uninstalled.
 
Do you mean "Disk Cleanup" instead, or a 3rd party "Disk Cleaner" program?

Did you have anything else running at the time that may have interfered?
 
The Windows 8 Built-in "disk cleanup".

Nothing else was running that I know would have interfered with the clean-up process.

I have noticed it has happened on a few occassion at about the same point.
 
Ok Brink, will give it a go, see what it says, however as mentioned, other than that "Disk Cleanup" issue, I can't see much wrong with the system
 
Thanks Brink, however I guess I still don't know why [1] The Disk cleanup keeps pausing 2/3 of the way through when cleaning the System Restore and Shadow Copies option and [2] why it did not respond when I ran DISM /Scanhealth command.

I think I may leave it for now and not worry about it too much, what do you think?
 
I wouldn't worry about it. Personally, I like using CCleaner to delete junk and stuff with.
 
The technet article at Configure a Windows Repair Source states that a repair source can be configured to either be the default Windows update, a mounted image, or even a "side-by-side folder from a network share or from a removable media, such as the Windows DVD, as the source of the files. For example, z:\sources\SxS." None of these methods have worked for me. I have several omg images made by DiskImage, fully mountable as drives, and made when there were no corrupt files and when DISM was functioning perfectly. Yet if I mount those images and point DISM to them as the repair source, I get the same error message. I am not certain about the syntax of the commands, or if perhaps something was left out, or if maybe there was supposed to be a space somewhere in the specified command. Yet the syntax these days is not as particular as it used to be. For instance, you don't have to type "DISM.exe": just "DISM" will work just fine. Mounting the image of the C: drive as H:, I got the same error message using the command DISM.exe /Online /Cleanup-image /Restorehealth /Source:H:\Windows /LimitAccess. I thought perhaps that I should be more specific, so I tried dism.exe /Online /Cleanup-image /Restorehealth /Source:H:\Windows\SysWOW64 /LimitAccess. I played around with several different images and even folders, but nothing worked. Looking at the dism log, it does not appear that, when I tried to point DISM to H: that it was actually looking at H:. The only mention of H: in the log is when it copies the command itself. I see lines such as this, which gives me the idea that there must be something wrong with my syntax:
2013-10-05 16:50:23, Info DISM DISM Provider Store: PID=3488 TID=916 Loading Provider from location C:\Users\George\AppData\Local\Temp\A6BEBF1B-CFA8-4F10-897E-2159FD14B2DE\OSProvider.dll - CDISMProviderStore::Internal_GetProvider


One blog has an amusing comment relevant to the "The restore operation failed. Either the repair source was not found or the component store cannot be repaired" message. At Oliver's blog, Windows 8: Updates and Maintenance - Oliver's Blog - Site Home - MSDN Blogs, the author has a good discussion of the general topic of Windows corruption repair. Oliver comments, regarding his encounter with that same verbatim error message, "This is a pre-release example, which was failing because the files were not available on Windows Update. This is not expected to be a real-world failure case." So this occurred in the pre-release world, but was not expected to result in "real-world failure" cases. From long, sad,experience, I'm wondering how anyone could expect otherwise.






 
Well after having some strange issues with my pc I noted in this old thread, I figured out one of my RAM sticks was somehow defunct. I now have 3 perfectly funtioning RAM sticks, but I am having other odd issues every now and then (it might not shut down at all, or certain Windows related activities freeze up). Running sfc /scannow gives me:

"Windows Resource Protection could not perform the operation requested"

So I ran Dism /Online /Cleanup-Image /RestoreHealth and get:

Error: 14098
The Component Store has been corrupted.


Any ideas if this is repairable without a full reinstall :(
 
I hope it works for you. Be sure to back up anything that you do not want to lose just to be extra safe though. Please let us know how it went. :)
 
So after about 90 mins I just got an error that said:

The Windows 8 installation has failed.

Very useful :P
So now I'm just trying to wipe everything and start again with the "Remove Everything and Reinstall Windows" option. It tells me "Some of the necessary files are missing" and to insert my recovery media disk, which I have done and it says the disk is not valid, now I don't know what to do!

Edit:
Just trying this now to get the files I need, I guess the CD I made during my first install (like a year ago) must not be valid for some reason. I wonder though if something is corrupt or missing though will the new USB recovery drive not still retain the same problems?

Edit Edit: :)

Well that didn't work either, same problem of USB not valid :(
 
Wilson,

It sounds like it may be time to do a clean install. :(
 
Brink - once again you saved my pc. I really appreciate your efforts. This has worked for me twice now - even tho this pc was upgraded from Windows 7 to Windows 8 to Windows 8.1. Your posts really help a lot of people, I'm sure. Thank you again!
 
Earlier in this thread, I posted the following:

I'm stuck. I used to run the Dism /Online /Cleanup-Image /RestoreHealth command relatively frequently, and it always worked fine. Now, I'm getting the following error after running it:

The restore operation failed. Either the repair source was not found or the component store cannot be repaired.
So, I just installed the Windows 8.1 update last night. Today, after dealing with a few frustrations the update offered me, I tried running DISM again, and ... voila!

C:\WINDOWS\system32>dism /online /cleanup-image /restorehealth

Deployment Image Servicing and Management tool
Version: 6.3.9600.16384

Image Version: 6.3.9600.16384

[==========================100.0%==========================]
The restore operation completed successfully. The component store corruption was repaired.
The operation completed successfully.
 
Back
Top