Knowledge - Details
DISM & SFC Tips
Date Added: 4/22/2017
Date Added: 4/22/2017
This is the Ideal command that runs both DISM and SFC sequentially so you don't have to wait for DISM to finish before running the next step. It's hopefully the only command you'll need to repair both the Component Store and system files. Run as administrator. DISM /Online /Cleanup-Image /RestoreHealth & sfc /scannow ---------------------------------------------------------------------------------- Commands to get DISM documentation dism /? dism /online /? dism /online /cleanup-image /? ---------------------------------------------------------------------------------- Commands to get additional information or do extra steps Tip: "/Online" just tells tells DISM to scan/repair the currently booted operating system, as opposed to scanning an offline OS that you might have installed on a separate hard drive. REM Create a report about the component store before making any changes. This is an optional step just so you can see the before and after reports after running all the cleanup commands. Dism /Online /Cleanup-Image /AnalyzeComponentStore REM See if the component store is already flagged as damaged. This is only for your information in case you're wondering if the component store is already flagged. Dism /Online /Cleanup-Image /CheckHealth REM If the component store is not flagged as damaged, ScanHealth will run a full scan to see if it is actually damaged. This does not fix anything on its own and has no effect on a following RestoreHealth command, so running ScanHealth is optional and only for your own informational purposes. Dism /Online /Cleanup-Image /ScanHealth REM The RestoreHealth command automatically performs the ScanHealth command followed by a repair process, so you do NOT need to run ScanHealth separately. This actually repairs the WinSxS Component Store. It outputs a huge, barely helpful log file at C:\Windows\Logs\CBS\CBS.log. Dism /Online /Cleanup-Image /RestoreHealth REM Now that the component store is repaired, these following commands can help shrink its size. REM Remove any backup files created during the installation of a service pack. Dism /Online /Cleanup-Image /SPSuperseded REM Clean up the superseded components and reduce the size of the component store Dism /Online /Cleanup-Image /StartComponentCleanup REM Reset the base of superseded components, which can further reduce the component store size. WARNING: This prevents you from uninstalling any past updates. Dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase REM Finally, create a final report about the component store size Dism /Online /Cleanup-Image /AnalyzeComponentStore REM This is a good time to run the system file checker because SFC uses files from the (freshly repaired) WinSxS component store to replace any corrupt files it finds. sfc /scannow ----------------------------------------------------------------------------------
Disclaimer: Everything on this website is written for my own use. I disclaim any guarantees that the procedures and advice listed here are accurate, safe, or beneficial for anyone else. If you attempt to follow any procedures or advice shared here, you do it at your own risk. Part of IT work is knowing how to recover from problems.