Windows Server 2012 and Windows 8 Component Store

So a few times now I’ve come across a system that had a corrupted component store, usually by trying to run SFC /ScanNow and failing, whether it be by power loss, hard drive crash or other. I’ve found some good commands on how to attempt to repair the component store and thought I would put them here so I could find them easily.

First is how to manage and clean up your component store:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Dism.exe /online /Cleanup-Image /SPSuperseded

The first command analyzes your store and tell you if a cleanup is needed, the second command does the cleanup (/ResetBase blocks the uninstallation of all SP’s and updates), and the third command removes all updates that are superseded by the latest installed SP.

Now to scan and repair the component store:

Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth

CheckHealth checks to see if a corruption marker already exists in the store, ScanHealth scans the store for corruption and RestoreHealth TRIES to fix the corruption.

Eightforums has great write ups on these commands and I recommend looking at them for more information:

DISM – Fixing Component Store Corruption in Windows 8

WinSxS Folder (Component Store) – Analyze in Windows 8.1

WinSxS Folder (Component Store) – Clean Up in Windows 8.1