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

Hi!

Yesterday I installed Vista SP2, but crashed during the reboot. After getting up again, Windows now says it is SP2, but I wanted to make sure that all system files are ok. So I ran SFC /verifyall, and no integrity violations were found, so far so good. When I create the sfcdetails.txt file to show only the [SR] lines from the CBS.log, still no anomalies are found. So everything looks okay!

But when I look in the CBS.log, nonetheless some non-empty POQ entries are created. It looks like there are only 3 kinds of created lines:
- Move File (a lot of PendingRenames in winsxs folder)
- Set File Information (for various files, but always attributes 000080)
- Set Key Value (in registry, for sysprep node, e.g. cleanup and generalize values)
In total there are about 1350 of such numbered items.

What could be the reason for this, and why are those lines created? And what should I do? Since Windows thinks it has SP2 installed and everything is uptodate, I don't want to fix what is not broken, so I don't want to let SFC actually repair things. Can I just let it be? Or will I have problems with future windows updates?

Thanks for your help in advance!

Kind greetings,
Jeroen
 
Hello Jeroen, and welcome to Vista Forums.

Since you SFC did not find anything wrong, I would not worry about it. I'm not certain what the lines are for, but it appears that it may just be some pending actions that will be done apon the next restart of the computer. You should be fine. :)

Shawn
 
Hello Brink,

Thank you for your fast response!

Those lines were created because I did SFC /verifyall (not a real /scannow), so I DON'T think they are in any queue, waiting to be executed. So I DON'T think they will be executed on the next restart?

But I DO keep wondering WHEN these lines eventually will come up. WHEN will be the next time a process (like Windows Update) does the real /scannow thing? Because THEN all of these lines MAY come up. And even for a very small future update, if ALL those lines will ALSO be generated at that time, THAT will be a MAJOR task. And when an update has got to do a thousand things, I'm not pretty sure all will go well.

So I'll keep worrying a bit for some time, in spite of your advice :confused:

Kind greetings,
Jeroen
 
Last edited:
Hi Brink! I just wanted to say, thank you! That information was absolutely spot on and fixed my system. I had been staring at the Vista DVD dreading a full reinstall, but the sfc scannow command worked beautifully! There were a few file it could not repair ("user32" something) but it doesn't seem to matter.

Thank you again for the tutorial!!!
 
Re: System Files

Hi JohnLug,

Windows Mail is an e-mail client like outlook but with less features as compared with that of outlook. However, windows mail is an integral part of the operating system(vista) whereas outlook is part of Microsoft Office suite. so, when you perform a repair installation the files of windows mail will be replaced since it a part of the windows operating system and outlook would remain the same. Inplace upgrade would make the necessary changes to the files of the windows folder only in the root drive.
So, outlook settings would remain the same. However you should always backup anything you do not want to lose just in case something goes wrong as mentioned by Shawn.



Anand
 
Hi the .sfc file is created on the desktop but when I open it it is blank?

Over the past few days the blue screen has appeared for some reason.
My os is home premium 64bit.

Why would the file by blank?

Thanks
Bayrak
 
Hello Bayrak, and welcome to Seven Forums.

Did you run the sfc /scannow command first? If you did, then it may not have found anything wrong, or you may have made a mistake somewhere doing the command to generate the report file.

Hope this helps for now,
Shawn
 
Hi, Yes I ran scannow and it did say there was some errors but was unable to fix?

The blue screen has not appeared since running the scan earlier today? (hope it fixed what ever was wrong). But I wanted to see the txt file. As the txt file was created I'm sure I did that part as instructed.

Anyway I'll see how it goes over the next few days.

Thanks again


Bayrak
 
Hi, Yes I ran scannow and it did say there was some errors but was unable to fix?

The blue screen has not appeared since running the scan earlier today? (hope it fixed what ever was wrong). But I wanted to see the txt file. As the txt file was created I'm sure I did that part as instructed.

Anyway I'll see how it goes over the next few days.

Thanks again


Bayrak

Hi Again, well several blue screens today so not sorted as I thought. Just for info I have uninstalled update KB973879 as recommended by MS.
Also in device manager it looked like there was a problem with a display adaptor which looks sorted now.

Error message after you apply update 973879: "Stop 0x0000007e" or "Stop 0x00000050"

The blue screen I was seeing gave me the error "Stop 0x0000007e"

Hope this is of use for others or perhaps you already know about it.

Anyway fingers crossed, no more blues.

Bayrak :D
 
Bayrak,

I'm happy to hear that it seems to be sorted now. Thank you for posting back the solution that you found. :)
 
Some quick feedback - discovered these forums recently (wish I had found them earlier!). A bit of detail to reassure anyone reading it does work and will not trash the disc :)

I had some real niggly issues, hard to put my finger on what, all sorts of symptoms, would work fine for days, then "poof" it starts, problems go away, then starts again yaddie yadda. There was no over arching symptom or something I could point a finger at - other than sending me to the mental asylem.

Whilst I sure as hell am no technician, I am an experienced user having been with windows since the very first Windows V1, and this was driving me nuts.

Anyway .... did a search on one of hassles - running 32 bit IE on Vista 64 (I need it for running videos, many formats still will not work inside Vista 64, and IE32 had mysteriously stopped working today), and came across these forums. Well, strike me vitals as they say ..... all sorted, the lot, not just IE32.

I had run sfc /scannow, and it must have wondered what the hell it was dealing with as it took 20 mins. Rebooted as instructed (and immediately before closing stage it applied the updates/fixes it had made), it was a clean restart. On reboot Norton complained and fell over, looks like one of their classic patches had been undone, however that was easy, did the Norton updates 2/3 times and after repeated "all done" messages, rebooted again. This time Norton was a happy bunny - real fickle Norton's, but I am hooked by it, I like it.

So far no problems since.

So endeth the waffle.

Thanks guys, did the trick for me, one happy user and new Forum member.

Regards
Zy
 
Hello Zydor, and welcome to Vista Forums.

I'm happy to hear that you got it sorted. Thank you for posting back with your results. :)

Shawn
 
I ran SFC and it found a file it could not fix: c:\windows\system32\udhisapi.dll. I was able to restore the file, but SFC still fails on the same file. It finds a hash mismatch. The file date indicated it has has not changed since 11/2/2006.

From reading the posts, it seems I can try a system restore or a repair install. However, my install disks are SP1 and the system is at SP2. Does slipstreaming SP2 work for a repair install? Anything else to try?

Thanks...
 
Hello SolarMan, and welcome to Vista Forums.

You might give a system restore a try first if the file was not corrupted to long ago.

A slipstreamed SP2 should be able to work to do a repair install with, but I have not tired it yet.
 
Top