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

One last question, I did a chkdsk before sfc and it froze at stage 5 43% for 3 hours, I talked to Dell tech support and they told me to just reboot the laptop. I'm wondering if the corrupted files maybe the reason for chkdsk not being able to finish.

Thanks for the quick response. :D
It could be. Chkdsk is is for corrupted hard drive sectors, and SFC is for corrupted system files. Unfortunately they cannot always repair the corruption. :(
 
Brink...

You are indeed amazing! This website should be the first resource for anyone with a Vista problem.

I'm still having problems periodically with the error message "....Desktop refers to a location that is not available." Rebooting always fixes the problem. Someone suggested that I try sfc. Not being familiar with that, I came to this forum and found all the info I needed.

So I ran sfc /verifyonly and it found some violations. Following the suggestions in your tutorial, I then ran sfc /scannow. It found corrupt files but was unable to fix them. Viewing the cbs.log file, it appears that sfc was able to repair all corrupt files except one. After weeding through all of the log, I found this entry:

2009-05-09 15:37:36, Info CSI 0000014b [SR] Could not reproject corrupted file [ml:520{260},l:72{36}]"\??\C:\Program Files\Windows Sidebar"\[l:24{12}]"settings.ini"; source file in store is also corrupted

Two questions, 1) Is the source file referenced here Windows Sidebar? 2) If I simply delete the settings.ini file would Vista just autmatically recreate one? I used the Windows Sidebar for about a month when I got my laptop in December 08 but realized it was a resource hog and stop using it.

Vista Home Premium SP1 came preinstalled on my laptop so I don't have a Vista CD/DVD.

Some guidance on this issue would be greatly appreciated.

dtgVA
 
dtgVA,

Here's a copy of my settings.ini file below in a ZIP file that you can download and use to replace your corrupted on in C:\Programs Files\Windows Sidebar.

  • Take Ownership of your C:\Programs Files\Windows Sidebar\settings.ini file.
  • Rename your settings.ini file to settings.ini.bak so it will be a backup of the original.
  • Copy and Paste my settings.ini file to C:\Programs Files\Windows Sidebar, and approve.
  • Double check to make sure that the new settings.ini file has Trusted Installer as the owner.
Hope this helps,
Shawn
 

Attachments

dtgVA,

Here's a copy of my settings.ini file below in a ZIP file that you can download and use to replace your corrupted on in C:\Programs Files\Windows Sidebar.

  • Take Ownership of your C:\Programs Files\Windows Sidebar\settings.ini file.
  • Rename your settings.ini file to settings.ini.bak so it will be a backup of the original.
  • Copy and Paste my settings.ini file to C:\Programs Files\Windows Sidebar, and approve.
  • Double check to make sure that the new settings.ini file has Trusted Installer as the owner.
Hope this helps,
Shawn
Brink...

Thanks so much for your suggestions. I noticed something when I tried to Take Ownership of the settings.ini. The TAKEOWN command kept saying ERROR invalid argument/option - 'Files\Windows. I'm entering takeown /f c:\Program Files\Windows Sidebar\settings.ini . I know the directory exists because I can use cd c:\Program Files\Windows Sidebar and do a directory listing and see the settings.ini file. So I had take ownership of the settings.ini file using Windows Explorer and that worked. I copied the settings.ini file you provided and then ran sfc and it still reported the settings.ini file was corrupt as well as its source.

Later today I got the following message: Your user profile was not loaded correctly! You have been logged on with a temporay profile. I then rebooted and everything was okay. I realized then that my issues with the desktop not being found and this recent one must be due to a corrupt user profile. Does that assumption seem right to you?

I've read your tutorial about user profile not loading correctly and how to delete a user profile but I need some clarification before attempting this.

I only have one user account with me as Administrator. When I delete that account, you mentioned be sure to select Keep Files to save a folder on the desktop. When I reboot, will Vista ask me to create another user account? I noticed there is a hidden folder under my current user profile called AppData. Should that folder also be copied to the new user account name?

What will happen to access to all my applications? (i.e. Outlook and iTunes) I frequently backup my Outlook pst file as well as my iTunes Library. Is access to these programs depended on user accounts?

Thanks for the hand-holding,
dtgVA
 
dtgVA,

I would say that you do have some form of corruption with your user profile. See if you may be able to repair it first using this tutorial instead.

http://www.vistax64.com/tutorials/130095-user-profile-service-failed-logon-user-profile-cannot-loaded.html
Brink...

Okay, in regedit under the ProfileList entry I have two user accounts listed 1) My name and 2) Administrator. Neither have .bak at the end of the SID Key aka long number. I'm interested in fixing the user account with my name. So no .bak entry, what does that indicate?

dtgVA
 
It means that you'll have to use this tutorial below instead. Be sure to create backups of anything that you do not want to lose first to be safe though. :(

http://www.vistax64.com/tutorials/135858-user-profile-error-logged-temporary-profile.html

According to tihis tutorial, it too says the SID key should end in .bak. If my user profile SID entry in regedit does not have .bak, when I delete it, should it still recreate it when I reboot or is it permanently gone and I will create a completely new user profile/account?

I've saved the folders associated with the user account I want to delete to a DVD. When the account is recreated or a new one created, do I simply copy the old account files to the new one?

Much thanks,
dtgVA
 
It is suppose to recreate it. If not, then you can follow the NOTE under step 10 to create a new account and restore your user settings by copying the backed up C:\Users\(user-name) folders into the corresponding new accounts C:\Users\(user-name) folders.
 
Nothing fails but a try! I'm a little nervous about this :confused: but I have your instructions and have backuped my pertinent data so I think I'm prepared. I do think this is the right decision because the 'desktop is unavailable' and 'user login did not load properly' messages are starting to appear more frequently. It's weird that simply rebooting seems to bring everything back ok. It's as if the system temporarily loses the info then finds it. Anyway, wish me the best! I'll report back later tonight on how things went.

dtgVA
 
Nothing fails but a try! I'm a little nervous about this :confused: but I have your instructions and have backuped my pertinent data so I think I'm prepared. I do think this is the right decision because the 'desktop is unavailable' and 'user login did not load properly' messages are starting to appear more frequently. It's weird that simply rebooting seems to bring everything back ok. It's as if the system temporarily loses the info then finds it. Anyway, wish me the best! I'll report back later tonight on how things went.

dtgVA
I hope it goes smoothly for you. Please let us know how it went for you.
 
Hey Brink...

I made it back. And I'm not in tears! As I suspected, since I did not have a .bak SID entry, deleting the SID entry I did have actually deleted the user account; it did not recreate the account I was having problems with. Since you forewarned me in the tutorial that that might happen, I simply created a new user account. Creating the new user account was like starting with a fresh Vista without the hassle of having to reinstall all my applications. I did however have to setup Outlook and iTunes with all the proper settings. And all the websites I frequent that require user names and passwords, I had to re-enter all that info. I had all my backup information so it was just a little time consuming.

Thank you for assisting me on this journey! Any suggestions on maintaining a healthy Vista user profile so as to avoid these issues in the future?

Regards,
dtgVA
 
You're welcome dtgVA. I'm happy to hear that you got it sorted out now. My best advice is to avoid registry cleaning programs, and to always keep good backups to make restoring easy if needed.
 
The tutorial DOES NOT tell you how to run SFC...only how to read the logs and repair files that SFC could not repair...

Where is the instruction for running SFC? Am I missing something????
 
Hello Woodbear, and welcome to Vista Forums.

It sure does tell you how to in the steps under Here's How:. Just need to scroll down a bit further. ;)

You would want to run the sfc /scannow command.
 
This is what I love about Vista...when I completed sfc /scannow it reported some corrupt files that it could not fix but when I went to examine the files in c:windows/logs/cbs/cbs.logs it told me 'Access is denied' ... unbelieveable...I cannot look at my own logs...like what was I going to do? steal them? Really stupid.
 
Woodbear,

If you are having some issue in Vista, then you may be able to do a System Restore using a restore point dated before you had it to fix it.

Hope this helps,
Shawn
 
This is great, but once a file has been identified using SFC and showing in the sfcdetails.txt, how do you get it off the Vista DVD? I have taken ownership and have full rights over the file, but it is not located on the Vista DVD like the good ol' i386 in NT\2K\XP. Don't tell me that repair\reinstall is the only option. According to this MS article Some Windows Vista functions may not work, or Windows Vista may stop responding, step 3 at the very bottom says to copy a file over. If Vista has really changed to where single system files cannot be brought over, like in XP, this will sour me on Microsoft forever.

I will use the example appwiz.cpl for programs and features, which is in c:\windows\system32 on the hard drive. A seach of the DVD does find appwiz.cpl.mui, but what can I do with this?
 
Top