System Files - SFC Command

ByLine
How to Repair and Verify the Integrity of Vista System Files with System File Checker
Synopsis
System File Checker (SFC) checks that all Vista files are where they should be and that they are uncorrupted. This will show you how to verify and repair the integrity of Vista system files with the System File Checker (SFC) command codes.
How to Repair and Verify the Integrity of Vista System Files with System File Checker

information   Information
System File Checker (SFC) checks that all Vista system files are where they should be as they were by default and not corrupted, changed, or damaged. This will show you how to verify and repair the integrity of Vista system files with the System File Checker (SFC) command codes.
Tip   Tip
If SFC Cannot Finish or Repair a File:
NOTE:
This is for when after you run the SFC scan below, it cannot finish or repair a file. There is no guarantee that SFC can repair the system files if they are corrupted or damaged to much. If SFC still cannot repair them after this, then you might try running Check Disk (chkdsk), System Restore, a Repair Installation, or a clean reinstall of Vista.

1. How to Read the CBS.LOG
NOTE:
When SFC runs, it logs it's actions to the C:\WINDOWS\LOGS\CBS\CBS.LOG. You can find the specific SFC entries by searching for the [SR] tags in the log.
A) For how to see only the SFC scan details in the CBS.LOG:​
  • Open a elevated command prompt.
  • Copy and paste the command below into the elevated command prompt and press Enter.
    Code:
    findstr /c:"[SR]" %windir%\logs\cbs\cbs.log >%userprofile%\Desktop\sfcdetails.txt
  • Close the elevated command prompt.
  • Click on the sfcdetails.txt file that was just placed on your desktop to see the SFC scan details (ones with the [SR] tags) in the CBS.LOG.
  • You can safely delete the sfcdetails.txt file afterwards if you like.
2. Replace the Files that SFC Cannot Fix
NOTE:
If SFC cannot fix a file, it will be listed in the CBS.LOG above. Read the CBS.LOG to find out what file it is so you can replace it with a good copy.
A) For how, see:​
warning   Warning
Be aware that if you have modified your system files as in theming explorer/system files, running sfc/scannow will revert the system files such as explorer.exe back to it's default state. Make the appropriate backups of your system files that you have modified for theming if you wish to save them before running sfc/scannow.




Here's How:
NOTE:
If sfc cannot start or finish, then try running it Safe Mode.
2. In the elevated command prompt, type the command that you want to do in bold below in steps A to E to run System File Check.​
A) sfc /scannow - Scans the integrity of all protected system files and repairs the system files if needed. (See screenshot below)​
NOTE: Restores Vista's original setup of system files. (EX: Fonts, wallpapers, System32 files, etc.)
scannow.jpg

B) sfc /verifyonly - Scans and only verifies the integrity of all proteced system files only. (See screenshot below)​
NOTE: If it finds anything like in the screenshot below boxed in red at the bottom, you should run step A to see if it can fix it. See how to read the CBS log above for details on the SFC scan results.​
verifyonly.jpg

C) sfc /scanfile=(full path of file) - Scans the integrity of the chosen system file and repairs it if needed.​
EX: sfc /scanfile=C:\Windows\System32\kernel32.dll​
D) sfc /verifyfile=(full path of file) - Scans and only verifies the integrity of the chosen system file.​
EX: sfc /verifyfile=C:\Windows\System32\kernel32.dll​
E) sfc /? - For a list of all sfc command codes with description. (see screenshot below)​
SFC_Help.jpg


3. Press Enter.​
NOTE: It may take a while to finish.​
4. Close the elevated command prompt when it finishes.​
5. If you got a message to restart the computer in the command prompt, then restart the computer to finish the repair.​

Note   Note
If SFC could not fix something, then run the command again to see if it may be able to the next time. Sometimes it may take running the sfc /scannow command 3 times restarting the PC after each time to completely fix everything that it's able to.

If not, then download and run the 32-bit (x86) or 64-bit (x64) System Update Readiness Tool for your same installed 32-bit or 64-bit Vista, restart the PC afterwards, and try the sfc /scannow command again.

If still not, then you can attempt to run a System Restore using a restore point dated before the bad file occured to fix it. You may need to repeat doing a System Restore until you find a older restore point that may work.

If still not, then you can use the steps in the yellow TIP box at the top of the tutorial to manually replace the files that SFC could not fix.




That's it,
Shawn


Related Tutorials



 
Last edited by a moderator:
Shawn Brink

Comments

I had system restore points going back a few months but this did not help. I slipstreamed an SP2 disk from a Vista SP1 DVD and found that I did not have the upgrade option. I would get a message about the upgrade needing to be a newer version.

So, I recreated the slipstreamed SP2 and installed all the updates before finishing the SysPrep dialog with OOBE/Generalize/ShutDown. Same problem. It appears then that the problem is not an issue with the actual updates/version in the slopstreamed system but with what version the slipstreamed system thinks it is. Some version number someplace is not getting updated.

Needing to get the system working, I sprung for a TechNet subscription (I won't use pirated copies). This will also give me a try-before-buy opportunity on other software for the next year. The ISO I downloaded from MS ran and had the upgrade option available so I could do a repair install. It repaired the SFC items that could not be repaired by SFC :D. However, my cookies were removed to special folders and I don't know what else :(. I'm going to poke around to see what is missing, but I suspect it will be easier to do a Windows Easy Transfer to a file to save stuff and then bring it back in after the repair. Since I made a backup of the drive before the repair install, I can keep restoring the drive and try things until I get it right.

Thanks for a great web site!
 
You're welcome SolarMan. I'm happy to hear that you eventually got it sorted out so far. Thank you for posting back with your results. :)
 
I think its good to use sfc(space)/scannow Brink you are definitely a pros!!:D thanks for adding my knowledge but :huh: how about if something gone wrong why don't we just delete the corrupted file ? or using program that can recover it
 
Hello Jeff,

If you know what file it is, then you could use the Vista installation disk to copy and replace the corrupted system file with, if the SFC was not able to.
 
Could someone supply instructions on how to install one file off the installation disk? Would this also fix the sequestered file/data that SFC uses for it's check? I tried replacing one file from a backup set and SFC still complained that the file was corrupt, so I assume that the sequestered file/data that SFC checks against was bad.
 
Cool. Thanks for the fast reply. But what do you do when you replace the file and the system still thinks it is corrupt? I ended up doing a repair install, but that ended up being a lot of work to fix all the device drivers that broke. Is there a way to replace whatever source SFC looks at to decide that the files are corrupt? This was easy to do in XP, but seems impossible in Vista.
 
SolarMan,

I'm happy to hear that you got it sorted. :)

Usually the files have been updated from a Windows Update since being installed, so replacing them will usually always be with a older version of the file. Because of this, it usually results in having to reinstall the OS.

However, if you unhide both the system files and protected operating system files, then do a search for the system file you need to replace on the whole computer and replace that file at all locations found from the search. You may need to take ownership of the file at that location before it will let you as well.
 
Hey Brink,

I have been reading through your replies to everyone and it seems that you know your way around ;) so I am hoping you might be able to assist me as well...

I haven't been able to update my system for over a month now and when I try to use the SFC the following message appear: "Windows Resource Protection could not start the repair service".

I have no idea what is happening to my computer....I can't update anything....iTunes nor QuickTime....

I hope you can help,

cheers
davidid
 
Hello David, and welcome to Vista Forums.

You might see if doing a system restore at boot using a restore point dated before this problem to see if it may be able to fix this for you instead.

Hope this helps,
Shawn
 
Hey Shawn/Brink

thanks for the quick reply but I have tried to perform the system restore before (actually this morning) but it seems that it only displays actions from 6th of Dec. 2009 but this problem (updating) has existed for far longer than that.....I guess I am running out of options:mad:

hope you have some other ideas

thanks again
David
 
David,

Double check in Services to make sure that the Windows Modules Installer service is not disabled and set to "Manual". You may need to do this in Safe Mode or restart the computer afterwards to be able to though. Afterwards, see if you can run the SFC /SCANNOW command.
 
Brink,

I followed the procedures above and the Windows Modules Installer was enabled and was set to manual. I decided though to go through these procedures again and did it in safe mode but the problem still exists.....I tried the SFC /SCANNOW command and the same message appeared as before: "Windows Resource Protection could not start the repair service"....

I guess I have gone through most of the tutorials available on this subject and tried probably all of the suggested procedures but I get nothing.....

\David
 
Hi Brink,,I was doin the- elevated command prompt--SFC /SCANNOW and everything worked as it should.I even veiwed the- SFC details from the CBS.LOG,,BUT when i did a CHKDSK on the other command prompt it said-(i have to invoke this utility running in elevated mode).Where did i go wrong with this? it worked before
 
Hello Dan, and welcome to Vista Forums.

Elevated mode means to "Run as administrator". You can right click on the command prompt shortcut to "Run as administrator" with the chkdsk command. :)

Hope this helps,
Shawn
 
thank you!! i have my Microsoft Management Center back again!!

is it okay that the only files unable to be repaired were for windows sidebar that i never ever use?
 
Top