RUNNING THE MICROSOFT SYSTEM FILE CHECKER (SFC  /SCANNOW )

Author: Mike Boesen

Last updated: 4 April 2009

1.  Introduction

In an article which deals with backup strategies (see http://www.pcug.org.au/boesen/Backups/backups.htm ) I have described the use of the Microsoft System File Checker (SFC) utility to check the integrity of Microsoft system files.   I indicated in that article that if you are having any problems with a PC that is using a Windows 98, XP or 2000 operating system, there is value in checking the integrity of your system files as one of the first steps in attempting to determine what's wrong and to fix it.    I'm not aware of an equivalent utility for Windows Me or 95.  

This article explains how to run SFC, how to get around a problem associated with the possible need for insertion of an SP2 or SP3 update CD, and how to simplify and speed up the SFC run process.

2.  Normal running of SFC

To run SFC on a Windows 98 system:

If SFC determines that a Windows 98 system file is corrupt or missing you will be asked to insert your Windows 98 installation CD.  If you are running Windows 98 SP1, use the SP1 installation CD.

Detailed instructions for running SFC on an XP system are provided here: http://www.updatexp.com/scannow-sfc.html.  In summary:

SFC will pop up a smallish dialog box with a slowly moving progress bar.  The progress bar is indicating that SFC is checking the Microsoft system files in the folder C:\WINDOWS\System32\  (I have assumed in that C: is your system root). 

If any of the system files is missing or corrupt, it will then search certain system folders to see if it can find a healthy version of the target system file.  When a required healthy file can be found, it is then copied to the appropriate folder.  If a healthy target file cannot be found in those folders then SFC will request that you insert the XP installation CD.  If you have a CD that has XP incorporating the SP2 or SP3 update, then the subsequent steps in running SFC should be straightforward.  

When SFC finishes its work you will not get any report - the SFC progress dialog box simply disappears.   If any files are reinstated SFC will do that without telling you and as far as I know, a log file is not created.   This lack of feedback is not nice.

3.  Problems when insertion of an SP2 or SP3 update CD is required

If you have updated your XP system to an SP2 level but do not have an installation CD that incorporates the SP2 changes to XP (i.e. you have a separate SP2 update CD), you will need your original XP CD plus the SP2 update CD.   Some people have had problems with SFC not being able to find the SP2 update CD after it is inserted in the CD or DVD drive.  Marc Liron's article http://www.updatexp.com/scannow-sfc.html provides an analysis of problems and provides solutions in such a situation.

4.  Slipstreaming the XP CD to simplify the operation of SFC

In running SFC, there are some advantages in creating a 'slipstreamed' CD that comprises 'XP incorporating SP3' and using the contents of that CD when undertaking the SFC run.  Normally, if SFC finds that a system file is corrupt or missing it will try to find a healthy copy in the folder C:\WINDOWS\System32\Dllcache\  or - if you have installed a Service Pack - C:\WINDOWS\ServicePackFiles\   If it cannot find a healthy copy of the file in any of those locations it will ask you to insert your XP CD and will then look for the file in the folder \i386\ on the CD and may also request insertion of your SP2 update CD.  In some cases, SFC may be unable to find the relevant files on the SP2 CD.  What will happen in a post-SP3 situation is unknown to me - things might get even more problematic.

Therefore, there are advantages in having a single XP CD that contains XP updated to an SP3 level, so that CD can be inserted when and if requested.  That avoids any need to insert any update CD.   It also means that if you ever want to do a reinstall of XP then you have a single CD that includes all the SP3 updates.  Note that slipstreaming using the SP3 update file subsumes all the SP2 updates plus all the updates that Microsoft issued post-SP2 and prior to SP3.

The creation of a slipstreamed CD can be undertaken by using the freeware application nLite (from  http://nliteos.com/nlite.html

If you are using nLite to create an 'XP incorporating SP2' CD (I would not do that though - use the SP3 update!) you will need to have your original XP distribution CD and one of these:

If you are using nLite to create an 'XP incorporating SP3' CD you will need to have your original XP distribution CD (at any level - XP, XP SP1 or XP SP2) and the SP3 update executable file named WindowsXP-KB936929-SP3-x86-ENU.exe That can downloaded from Microsoft (about 360 MB in size, though). 

Instructions on 'how to use nLite' are in the pages that are accessed through this page: http://www.nliteos.com/guide/

In summary, this is how I would use nLite to create an 'XP incorporating SP3' CD:

  1. Install nLite version 1.4.5 or a more recent version.  This is freeware available here:  http://www.nliteos.com/  

  2. Get the SP3 update executable named WindowsXP-KB936929-SP3-x86-ENU.exe and place it in a suitably labelled folder on your hard drive

  3. Copy into a suitably labelled folder on your hard drive the complete contents of your XP distribution CD.  That CD would be either 'XP SP1' or 'XP including SP2'.

  4. Run nLite.  While nLite has lots of functionality for tweaking XP and for adding subsequent hotfixes, initially you might simply indicate (through browsing on the appropriate nLite screens) the location of the folder in which the 'Windows installation' is located (i.e. where you have copied the contents of your original XP distribution CD) and the location of the folder into which you have copied the 'Service pack' (i.e. the SP3 update executable).  In the nLite 'Task selection' screen, check the 'Service Pack' and 'Bootable ISO' buttons.   Apart from telling nLite where the appropriate folders are, in essence you can simply leave everything else set at the nLite defaults.
     
  5. At the appropriate time tell nLite where to write the ISO file for the 'XP incorporating SP3' CD.  After creating the ISO file, nLite can then burn the CD from the ISO image.

  6. After the CD has been created, extract and reinsert it to see if it will show the usual XP installation options.  Exit that and check that the contents of the CD look OK.  In my case, the CD has 634 MB of data in 7,171 files.

Note that nLite can also be used later to create updated versions of the slipstreamed CD at such times that Microsoft provides post-SP3 updates (referred to in nLite terminology as 'hotfixes').   That means that if you like you can at any time generate a single CD that contains XP including SP3 and later updates.

5.  Tweaking the registry and copying the i386 folder to the hard drive in order to run SFC faster

If you are able to make a couple of tweaks to your registry and then copy the i386 folder from your slipstreamed 'XP incorporating SP3' CD to your hard drive then there are two subsequent benefits:  you will not be requested by SFC to insert any original or update CD, and SFC will run much faster than it would if it were to have to read files from a CD.    

This is how to implement that procedure (note that I have assumed that C:\ is your system root):

1.  Make a backup of your registry either by creating a System Restore Point or by use of the freeware application ERUNT (as explained here: http://www.pcug.org.au/boesen/ERUNT/ERUNT.htm ).  This step is optional but advisable in case the registry tweaking creates problems or is undertaken incorrectly.

2.  Copy the folder \i386\ with all its contents and subfolders from the slipstreamed 'XP incorporating SP3' CD onto your C: drive as C:\i386\

3.  In the steps below, I assume that you are using Microsoft's Regedit to edit the registry.  Start Regedit this way: 

Start  |  Run  |  type in RegEdit and hit OK.   

Then navigate to this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup

In the right-hand panel's "Name" column find the value named SourcePath  The data shown for that value will probably be the drive letter of your CD or DVD drive (e.g. D:\ ).  


In the "Name" column, double-click SourcePath and change the data for that value to 'C:\ '  (without the quotes, and DO NOT type in C:\i386\). 

Hit OK

4.  See if there is a folder named C:\WINDOWS\ServicePackFiles\ on your PC.   If this folder does NOT exist, go to step 5.  If the folder DOES exist then do this:

4.1  In your registry editor, navigate to this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup

4.2  See if there there is a value named ServicePackSourcePath in the "Name" column. 

4.3  If there IS a ServicePackSourcePath value then:

Ensure that the data for the value is set to or is changed to 'C:\WINDOWS\ServicePackFiles' (without the quotes).  To change, right-click on the value name, then make the necessary changes.

Go to step 6

4.4  If there is NOT a ServicePackSourcePath value then:

In the right-hand panel then create such a value with its data set to 'C:\WINDOWS\ServicePackFiles' (without the quotes).  To create the value, right-click in the right-hand panel, click New / String value, type in 'ServicePackSourcePath' (without the quotes), hit Enter twice, type in 'C:\WINDOWS\ServicePackFiles' (without the quotes and without a trailing backslash) as the Value data and hit OK.   Note:  in some cases this does not seem to work and if that happens to you, try changing the data for the value to 'C:\' (without the quotes).

Go to step 6.

5.  If the folder C:\WINDOWS\ServicePackFiles\ does NOT exist, do this:

5.1  In your registry editor, navigate to this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup

5.2  See if there there is a value named ServicePackSourcePath in the "Name" column. 

5.3  If there IS a ServicePackSourcePath value then:

Ensure that the data for that value is set to or is changed to 'C:\' (without the quotes).  To change, right-click on the value name, then make the necessary changes.

Go to Step 6

5.4  If there is NOT a ServicePackSourcePath value then go to Step 6.

6.  Find this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

6.1  In the right-hand panel if there is no value named SourcePath then go to step 7. 

6.2  If there IS a value named SourcePath then:

ensure that the data for the value is set to or is changed to 'C:\' (without the quotes).  To change, right-click on the value name, then make the necessary changes.

Go to Step 7

7.  Exit your registry editor and reboot the PC.

To run SFC after rebooting or at any time in the future:

The SFC utility should now run without requiring the insertion of any CD.  It will run MUCH faster than it would if it had to access files from an \i386\ folder on a CD.   

5.  Closing comments

In my view, SFC is a very useful application to run if your PC is slowing down and behaving erratically.  If the problem is one of a corrupt or missing Microsoft system file/s then SFC may fix the problem.   As part of my preventative maintenance strategy I run SFC as a matter of course about every 10 days or so.  This is a simple matter to do because my i386 folder (which is at an SP3 level) is on my hard drive and because of that SFC runs reasonably quickly and does not require the insertion of any CD. 

There are some other articles about PC stuff on my site here: http://www.pcug.org.au/boesen/ 

Mike Boesen