AKB1000001: Using the System File Checker
By @NoelCarboni
Published 2 Feb 2017 rev 1.0
Microsoft provides a self healing feature for Windows called Windows File Protection. It’s been around for a while, actually. Windows File Protection helps keep Windows sane by watching for un-sanctioned changes to system files. A particular program called the System File Checker (SFC) is provided as part of Windows File Protection:
https://blogs.technet.microsoft.com/askcore/2007/12/18/using-system-file-checker-sfc-to-fix-issues/
The short story is that you want to get a little geeky you can use SFC to see if your Windows installation is healthy. It’s quite easy – just start an elevated CMD window and run this command:
SFC /VERIFYONLY
Go ahead and try it. It’ll run for a few minutes – or maybe even a few tens of minutes – and it will thoroughly check all your Windows system files.
Note that just checking your system’s health shouldn’t harm anything. It’s only checking, not changing things. You might even get a warm and fuzzy feeling when SFC says all’s well!
But the all important question is: What do you do if SFC reports an error?
SFC can be asked to try to repair basic problems it finds with the Windows system files using your local servicing database (hey, some of the data in all those gigabytes of Windows installation can actually be useful). Specifically If the above SFC /VERIFY command says there are errors, you can try a next step: Run SFC again but this time with a different switch, where you ask it to actually fix any errors it finds.
Note that if you have been hacking Windows system files yourself, you might have caused the errors yourself and an SFC repair will likely undo those hacks. I personally recommend never doing hacks that change system files and break Windows File Protection. It’s quite possible to run a customized and tuned up Windows 8 system that still passes SFC checks – I do!
This command asks SFC to repair any problems it finds:
SFC /SCANNOW
It might tell you that it found and repaired the errors. If so, that’s great and here comes that warm and fuzzy feeling. You’re all done!
But – unfortunately – there are some errors this command can’t fix. Like any files, the servicing database itself in Windows can become corrupted, making an SFC repair impossible. It can and does happen.
If SFC /SCANNOW informs you that it could not repair errors, you can dig through the file C:\Windows\Logs\CBS\CBS.log to find out why. It’s cryptic and voluminous, but a search for the string “cannot repair” often turns up the key clues. Pay attention to the dates and times as data from multiple runs accumulates in that log file, but persistence pays.
Last month I observed that an uncorrectable error was introduced on my Windows 8.1 system after I installed the December set of “Group A” (everything cumulative) updates:
Specifically, SFC reported (via CBS.log) that the file Sound Recorder.lnk was corrupted and that the corruption couldn’t be repaired because the “source file in the store was also corrupted”.
Fortunately, with Windows 8 and newer there’s a way to escalate the automatic repair process to yet another level – and it really works – using a DISM command. DISM is the Deployment Imaging and Servicing Management tool provided with Windows. Yep, now we’re gettin’ seriously geeky. Just like a crack IT professional.
Specifically, if you find yourself with errors that SFC just can’t repair, clear your schedule for 10 minutes or so and try this command:
DISM /Online /Cleanup-Image /RestoreHealth
It actually goes online to the Windows Update site and does what it can to repair the local servicing database on your running system! After running it, SFC /SCANNOW might actually be able to repair those errors it couldn’t repair before!
You can find more information on Microsoft’s site about DISM:
https://technet.microsoft.com/en-us/library/hh824869.aspx
Once the DISM command is done – which may take quite a while so be patient – go back and try the SFC /SCANNOW command again. There’s a good chance it will now succeed and you might actually get back to that warm feeling that Windows is healthy.
It worked for me.