How to Fix: 'sfc /scannow' Fails, Won't Complete

Discussion in 'Windows Error Code, Crashes, BSOD, and Hangs' started by securityhope, Sep 12, 2016.

  1. securityhope

    securityhope Administrator Staff Member

    Joined:
    Aug 3, 2016
    Messages:
    1,241
    Likes Received:
    0
    Trophy Points:
    36
    Infopackets Reader Terry C. writes:

    " Dear Dennis,

    I am trying to run the command 'sfc /scannow' (system file checker) through the Windows command prompt to repair corrupt Windows files, but every time I try and run 'sfc /scannow', it stops at 42% and gives the error message 'Windows Resource Protection could not perform the requested operation.' Therefore, the 'sfc /scannow' does not complete and I can't repair my corrupt Windows files. How can I fix this so I can finish running the scan and fix my files? "

    My response:

    I had the "Windows Resource Protection could not perform the requested operation" error recently, and the best way to resolve the issue is to reboot into safe mode and try and run 'sfc /scannow' through an administrative command prompt. That is easier said than done, however, as there are a number of steps you need to take before that can happen. Plus, there will likely be some issues along the way, including the possibility that the system file checker will also fail in Safe Mode, resulting in the "Windows Resource Protection found corrupt files but was unable to fix some of them" error, which is also a major pain to resolve.

    As such, I've written this article to explain how to properly run the 'sfc /scannow' command in Safe Mode, as well as how to resolve the "Windows Resource Protection could not perform the requested operation" error, including the "Windows Resource Protection found corrupt files but was unable to fix some of them" error.

    Please note that the instructions on this page apply to Windows XP, Vista, 7, 8 and Windows 10.

    In short, here are the summary of steps I've outlined in this document:

    • Scan the Hard Drive for Errors
    • Enable the Hidden Administrator Account
    • Set the Computer to Reboot in Safe Mode
    • Login as the Administrator User
    • Open an Administrative Command Prompt
    • Ensure that PendingDeletes and PendingRenames Folders Exist
    • Run the 'sfc /scannow' command in Safe Mode
    • Parse the CBS.log File if System File Checker Fails
    • Replace Corrupt System Files: for Windows XP, Vista, and 7 users
    • Replace Corrupt System Files: for Windows 8 and 10 Users
    With that said, let's get started.

    Scan the Hard Drive for Errors

    The first thing to do is to tell Windows you want to perform a file system check on the hard drive to ensure there are no errors. If there are errors on the drive, 'sfc /scannow' may fail.

    To scan the drive for errors, do the following:

    1. Open an administrative command prompt. In Windows XP, click Start -> Run, and type in "cmd.exe" and press Enter. In Windows Vista, 7, 8, and 10: Click Start and type in "cmd" (no quotes). Wait for Command Prompt or CMD.EXE to appear in the list of options and right click it, then select "Run as Administrator".
    2. A black command prompt window will appear on the screen. Highlight the following text with your mouse: "chkdsk /x /f /r" (do not include the quotes), then right click over the highlighted text and select Copy. Next, go to the command prompt and right click in the middle of the window and select Paste from the dialogue menu. The command you copied should have output to the command prompt. If it did not, repeat this step until it does. After the command is output, press Enter on your keyboard to execute it. When prompted, press "Y" to have chkdsk scan your hard drive for errors on the next reboot.
    Don't close the command prompt yet as there are more commands to enter.

    Enable the Hidden Administrator Account

    Next we'll enable the hidden administrator account so that you can perform the 'sfc /scannow' command in a clean environment.

    To do so:
    1. Highlight the following text with your mouse: "net user administrator /active:yes" (do not include the quotes), then right click over the highlighted text and select Copy. Next, go to the command prompt and right click in the middle of the window and select Paste from the dialogue menu. The command you copied should have output to the command prompt. If it did not, repeat this step until it does. After the command is output, press Enter on your keyboard to execute it.
    2. Please note that you will most likely want to disable the administrator account after you have finished making changes listed in this document, otherwise anyone will be able to login to your computer as the administrator user without using a password and make changes to the system without any authorization. You can disable the administrator account using the exact steps you just took above, except you would replace "net user administrator /active:yes" with "net user administrator /active:no".
    Proceed to the next step.

    Set the Computer to Reboot in Safe Mode

    Now you will need to reboot the computer in Safe Mode. One of the easiest ways to do that is to set the Safe Mode option using the msconfig utility.

    To do so:

    1. In Windows XP, click Start -> Run, and type in "msconfig" (no quotes) and press Enter. In Windows Vista, 7, 8, and 10, click Start and type in "msconfig" (no quotes) and press Enter.
    2. The msconfig window will appear; click the Boot menu tab near the top. Under the "Boot options" heading, tick the "Safe Mode" box and then click Apply, then OK. You will most likely have a window that pops up asking you to reboot. You can choose to reboot now, or do it manually from the start Menu.
    3. After the computer reboots it will perform a file system check on the C drive. If it finds any, the system may reboot again.
    Note: you will need to undo the Safe Mode setting after you have finished making changes listed in this document, otherwise the system will continue to reboot in safe mode repeatedly. To undo the Safe Mode, simply remove the check mark that you ticked off in the steps above.

    Proceed to the next step.

    Login as the Administrator User

    When chkdsk has finished scanning the drive, you will be taken to the login screen; choose to login as the Administrator user. After doing so, you may have to wait a few minutes for Windows to create the administrator desktop in order to complete the login, so please be patient. Also note that there is no password set for the hidden Administrator user; you only need to click the account to login with no password.

    Open an Administrative Command Prompt

    Once you've logged in as the Administrator user, the next step is to open an administrative command prompt.

    To do so: In Windows XP, click Start -> Run, and type in "cmd.exe" and press Enter. In Windows Vista, 7, 8, and 10: Click Start and type in "cmd" (no quotes). Wait for Command Prompt or CMD.EXE to appear in the list of options and right click it, then select "Run as Administrator". A black command prompt window will appear on the screen.

    Proceed to the next step.
     
  2. securityhope

    securityhope Administrator Staff Member

    Joined:
    Aug 3, 2016
    Messages:
    1,241
    Likes Received:
    0
    Trophy Points:
    36
    Ensure that PendingDeletes and PendingRenames Folders Exist

    Note: Windows XP users can skip the instructions below because it does not apply to them. Instead, skip ahead to the section that reads "Run the 'sfc /scannow' command in Safe Mode" immediately below.

    According to the document, "Use the System File Checker tool to repair missing or corrupted system files" (Microsoft KB 929833), you will also need to ensure that two folders exist on your system before you can run the 'sfc /scannow' command again.

    To ensure the folders exist, do the following:
    1. Highlight the following text with your mouse: "mkdir %WinDir%\WinSxS\Temp\PendingDeletes %WinDir%\WinSxS\Temp\PendingRenames" (do not include the quotes), then right click over the highlighted text and select Copy. Next, go to the command prompt and right click in the middle of the window and select Paste from the dialogue menu. The command you copied should have output to the command prompt. If it did not, repeat this step until it does. After the command is output, press Enter on your keyboard to execute it.
    2. If you receive an error that a folder already exists, ignore the error.
    Run the 'sfc /scannow' command in Safe Mode

    The next thing to do is to run the 'sfc /scannow' in the command prompt.

    To do so:

    Highlight the following text with your mouse: "sfc /scannow" (do not include the quotes), and copy it to your clipboard as you did previously. Go to the command prompt and paste the command using the right click. The command you copied should have output to the command prompt. If it did not, repeat this step until it does. After the command is output, press Enter on your keyboard to execute it.

    System File Checker (sfc) should now execute and scan the system until it reaches 100%. If it fails before 100% with either the error message that "Windows Resource Protection found corrupt files but was unable to fix some of them, proceed to the next step immediately below", or "Windows Resource Protection could not perform the requested operation", then you will need to proceed to the next section, "Parse the CBS.log File if System File Checker Fails," or perform a Windows Repair Install (described as the very last option further down).

    If it does not fail, then you have achieved what you have set out to do, and you should pat yourself on the back. You will now need to disable Safe Mode using msconfig so you can reboot your system normally. In that case, launch msconfig as previously described and remove the checkmark next to the safe mode option. You will also most likely want to disable the administrator user; in that case,refer to the section on enabling the administrator user and disable the account.

    Parse the CBS.log File if System File Checker Fails

    If the 'sfc /scannow' command fails before it reaches 100% (with the error "Windows Resource Protection found corrupt files but was unable to fix some of them, proceed to the next step immediately below" most likely), then you will need to parse the CBS.log file (which is created by system file checker) in order to figure out which file is corrupt on the system.

    To do so:

    1. Using the administrative command prompt window that is already open from the previous step above, highlight the following text with your mouse: "findstr /c:"[SR]" %windir%\logs\cbs\cbs.log >%userprofile%\Desktop\sfcdetails.txt" (do not include the quotes). Right click the highlighted text and select Copy, then go to the command prompt window, paste the command, and press Enter on the keyboard to execute it.
    2. Windows should have placed a file on your desktop called "sfcdetails.txt". It will contains parts of the CBS.log file that will specifically tell you which file on your system is corrupt and causing the 'sfc /scannow' command to fail. Double click on the sfcdetails.txt and scroll through the file and note any errors listed in the log.
    Proceed to the next step.

    Replace Corrupt System Files: for Windows XP, Vista, and 7 users

    If you run Windows XP, Vista, and Windows 7, you can replace the corrupt file from your Windows DVD if you have one.

    There are a few caveats with this approach, however:

    1. If there are many files to replace, it might be easier to insert the Windows DVD (if you have one) into the drive, reboot, and do a "repair" install (rather than a full reinstall). A repair install is similar to a full reinstall but you wouldn't lose your installed programs. You will however need to download a lot of updates after the repair.
    2. You can extract the corrupt files from the original DVD without doing a repair. This is the preferred method if you don't have a lot of files to replace, though you will have to locate the original path where the corrupt file is stored (according to the sfcdetails.txt log file), then go through the install.wim file the original Windows DVD and replace the damaged file(s). Providing instructions on how to do this is too lengthy for this document, so I've provided a link to a page that explains it.
    3. If you don't own a Windows DVD and only have a 'recovery partition' then you best bet is to either obtain the correct and non-corrupt file(s) from another source (such as another PC with the exact same operating system), or reinstall Windows using your recovery partition if you have one.
    Optionally, you can do a repair install (described as the last step), which is most likely the easiest option.

    Replace Corrupt System Files: for Windows 8 and 10 Users

    If you own Windows 8 or 10 then you can run the 'DISM' file utility to replace the corrupt files using Microsoft's servers.

    To do so:
    1. Open an administrative command prompt by clicking on Start, and then type in "cmd" (no quotes). Wait for Command Prompt or CMD.EXE to appear in the list of options and right click it, then select "Run as Administrator".
    2. A black command prompt window will appear on the screen. Highlight the following text with your mouse: "Dism /Online /Cleanup-Image /StartComponentCleanup" (do not include the quotes), then right click over the highlighted text and select Copy. Next, go to the command prompt and right click in the middle of the window and select Paste from the dialogue menu. The command you copied should have output to the command prompt. If it did not, repeat this step until it does. After the command is output, press Enter on your keyboard to execute it.
    3. Repeat the same steps as above, except enter the command "Dism /Online /Cleanup-Image /RestoreHealth" (do not include the quotes).
    4. Wait for DISM to complete its scan and hopefully it will report back it made some fixes. After that completes, try running 'sfc /scannow' again in the same command prompt and pray that it reaches 100%. If it does not, then you will have to use the same approach to repair corrupt files described above for Windows XP, Vista, and 7 users.
    Optionally, you can do a repair install (described next), which is most likely the easiest option.
     

Share This Page

Share