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

Thanks for the advice.

I have no idea what may have caused the problem or how far it may go back. I think I'm resolved to reinstalling vista from scratch. I've been having numerous other system problems including critical services failing to start, hence the desire to use sfc but they may be beyond simple repair.

Cheers David
 
Ok i'm stuck. I have had vista for almost a year and throughout the year it has slowly been eating itself away. I bought windows xp and am prepared to downgrade but i decided to give vista one more try.

In short i'm trying to get my check disk to run. I've tried running it in the command prompt, safe mode, on start up, warm boot, cold boot, hard boot, NOTHING.


I following the steps on the forum with the SFC scan, i get this
_______________________________________________________________________

C:\Windows\system32>sfc/scannow

Beginning system scan. This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.Windows Resource Protection found corrupt files but w
as unable to fix some of them.
Details are included in the CBS.Log windir\Logs\CBS\CBS.log


C:\Windows\system32>findstr/c:"[SR]" %windir%\logs\cbs\cbs.log>sfcdetails.txt

______________________________________________________________________

what does it mean? I tried to access the CBS log and when i click on the text file it says access is denied? didn't pull up anything in the command prompt either as you can see.

so my question is what do I do?
 
Hi Barnesa4,

To read the CBS log use the method at the top of this tutorial to be able to without getting the access denied.

With the number of problems you have, I would recommend that you backup what you do not want to lose and do a clean install.

Shawn
 
Okay so I have been prompted multiple times by vista because of LoginUI.exe file is corrupt to run chkdsk. everytime I've tried running chkdsk /r it wasnt working and wouldnt on start up. Also the next time I started my computer it started prompting it for everything say 03E0M.exe (or something like that) is corrupt, Yahoo.exe is corrupt, and so on. Then I found this forum and I felt a sense of hope. So I started running sfc /scannow it got 75% of the way done and then said: "Windows Resource Protection could not preform the requested operation."

So I decided to then run sfc /verifyonly and that said "Windows Resource Protection found integrity violations details are included in CBS.log"

So, what should I try doing next a system restore, repair installation, clean installation? I just dont want to go through all of the work of one to find out it doesnt work. Does this chkdsk problem seem to be a purely vista problem? Thanks for all your hard work on this great website, its the one place thats given me so much help.
 
Last edited:
Hello MarryPoppins,

I would recomend doing a System Restore using a restore point dated before this problem first to see if it can fix the problem for you.

Hope this helps,
Shawn
 
Idk what happened but like the third time I shut my computer off manually, and it coming back on a screen popped up requesting to fix problems, it was like startup repair or something. While anyways it worked I believe Im gonna see if I can run a chkdsk today.

chkdsk didnt work but the sfc /scannow did. now I need to look at the cbs.log

how do you know the path and file name of the things that are placed in the cbs.log?
 
Last edited:
MarryPoppins,

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 SFC specific entries by searching for the [SR] tags in the log.
A) For how, see: Microsoft Help and Support: KB928228, then type sfcdetails.txt in the same elevated command prompt and press Enter to be able to read the log file.

Hope this helps,
Shawn
 
I can access my CBS.log that doesnt mean I understand it. I was wondering from the CBS.log how you know the path of the file like C:, E:, and so on. and how you know file name, because now inorder to fix the problems I have to copy a good copy. So I just didnt get how they got the example from what they show


"2007-01-12 12:10:42, Info CSI 00000008 [SR] Cannot
repair member file [l:34{17}]"Accessibility.dll" of Accessibility, Version =
6.0.6000.16386, pA = PROCESSOR_ARCHITECTURE_MSIL (8), Culture neutral,
VersionScope neutral, PublicKeyToken = {l:8 b:b03f5f7f11d50a3a}, Type
neutral, TypeName neutral, PublicKey neutral in the store, file is missing.

1.
At an elevated command prompt, type the following command, and then press ENTER:
takeown /f Path_And_File_Name
For example, type takeown /f E:\windows\system32\jscript.dll."

I dont get how they know its E:\ and everything else. If it helps heres the url to what Im looking at.

Some Windows Vista functions may not work, or Windows Vista may stop responding

Sorry if Im not clear at what Im trying to do, this is my first time working with vista, and before that I never did anything with computers.
 
Ok, I see what you mean now. That was not a very good example they used to go with a [SR] tagged error. It would just be the path inside your Vista, which is usually C: instead. The [SR] tagged error will tell you which file was bad. However, this is a very complicated task that usually may only work if you extract the replacement files from the Vista installation DVD instead. This of course is even more complicated to do.

Over all it doesn't not have a high chance of success. Instead, I would recommend doing a Repair (upgrade) install. It's easier to do and usually fixes the problem. This tutorial will show you how to.

http://www.vistax64.com/tutorials/88236-repair-install-vista.html

Hope this helps,
Shawn
 
After typing in sfc /scannow I get the following:

Beginning system scan. This process will take some time.
Windows Resource Protection could not perform the requested operation.

Any ideas how to get around this?

Regards

Neil
 
Brink,

Thanks. Startup repair and System Restore both tried and failed. The Vista repair is a great idea but the instructions state that it will not work if I have to use the disk to boot. Using the disk to boot is the only way I can get it to start at all. It is stuck in a boot loop and crashes before I can even get it into safe mode. The added problem is that I only have an OEM Vista 64bit installation disk. Any further ideas are much appreciated. Are you sure the repair option will not work if I use the disk to boot?

Regards,

Neil
 
Neil,

Sorry, but yes it will only work from within the current OS. Booting from the Vista installation DVD will only allow you to have the custom option to do a clean install. It sounds like your problems are beyond a repair job though. :(

Sorry,
Shawn
 
I tried the scannow as chkdsk will not run at start up, when it was verifying in cmd etc it said "Windows resource protection could not perfrom the requested operation" ?
 
I tried the scannow as chkdsk will not run at start up, when it was verifying in cmd etc it said "Windows resource protection could not perfrom the requested operation" ?
I'm having the same problem I did a repair install and it worked but only temporarily so I would recommend doing a clean install.
 
Hi Brink, i am trying to check my HD with chkdsk (i tried all the methods) but this one doesn't want to work on reboot, so i followed this tutorial for the SFC but it always stops the verification process in 67% even in the safe mode and it shows an error message saying that it cannot perform the asked operation. What does it mean ??
 
Top