Over the past few weeks I have experienced several interesting problems between my two computers. Of particular note was an issue I discovered when the Event Viewer on my Windows 7 Ultimate 32-bit machine failed. After some troubleshooting I decided to attempt SFC /scannow. I got the error message "Windows Resource Protection could not perform the requested operation." This worried me. So I attempted to boot into WinRE from my Win 7 installation disk. The result in WinRE was the same. No good.
I scrounged forum after forum looking for an answer, but nothing worked. It seemed like everyone just gave up and reinstalled their OS, but I would not do that. So I kept exploring. CBS.log showed nothing of interest as sfc never made it past "Beginning verification phase of system scan."
Finally I found this article: http://www.updatexp.com/scannow-sfc.html which, while interesting and comprehensive, did not directly solve my issue. It did, however, point me to the registry key:
This registry entry does not appear to exist in Win 7, but another entry in it's vicinity caught my attention:
I had recently moved my program files dir to a different hard drive and placed a junction point in it's place. In the process I had altered HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir to point to "D:\Program Files\", then back to "C:\Program Files\" when the junction point was in place.
"C:\Program Files\" is incorrect!
the trailing backslash is incorrect, and must be removed!
with the ProgramFilesDir value set to "C:\Program Files" I ran sfc /scannow and it scanned properly, finding several corrupt files (some of which required checking cbs.log to repair).
I can imagine that some virus maker somewhere will use this to break SFC in the future, but here's your solution!
So to review: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir cannot have a trailing backslash!
Tell your friends! :)
Iv been having a similar problem first noticed a problem with error msgs when trying to run certain installers, tried to do sfc scan got same msg as you after researching it I felt in the same spot as you then I saw your post, unfortunately that did not work for me either there was no \ in ProgramFilesDir value.
this command does not work for me:
-----------------------------------------------------------------------------------------------------C:\Windows\system32>sfc /scannow /offbootdir=c:\ /offwindir=c:\windows
The arguments passed to sfc are invalid. The offline windows directory
specified points to the online system.
I realise this might be too late, but the error tells you that you have to specify the correct drive letters.
"offbootdir" is the system reserved patition (usually about 100MB in size).
"winbootdir" is the windows directory on the drive you would like to fix.
You can view the different drives (volumes) by using the DISKPART utility. In elevated command prompt (or PowerShell), type
to enter the Disk Partitioning Console, then type
to view your machine's volume details
Thank you to Crosmanrond!!! There was a power failure on my Windows 2008 R2 system while it was doing an update to Service Pack 1, and I have been struggling for a week to get sfc to run. While installing Java earlier, I received and error telling me Java could not find the %CommonProgramFiles(x64)%\ directory.
The SFC scans also only got to 15% and would then give me the same error "Windows Resource Protection could not perform the requested operation."
I did what you suggested - changed all the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir keys from e.g. "%ProgramFiles%" to "C:\Program Files" and the scan completed successfully.
Thanks a million!
- Edited by eminent_eddie Monday, October 15, 2012 9:12 AM wrong service pack number
I know this is a bit old, but I was having the same issue and this is still the second result via Google.
None of the above solutions helped me but the suggestion of using /offbootdir and /offwindir gave me the error that the drive isn't offline (makes sense since I was booted to the OS on that drive).
I pulled the drive and hooked it up via eSATA to another computer and was able to run sfc /scannow /offbootdir=f:\ /offwindir=f:\windows (F: being the drive letter when I hooked it up).
The scan worked but didn't return any errors. I'm not looking for help, just posting to help others that might find this.
Odd thing I noticed that my System Volume has no letter. Is this normal?
Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: LARRY-PC
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 F DVD-ROM 0 B No Media
Volume 1 System Rese NTFS Partition 100 MB Healthy System
Volume 2 C NTFS Partition 931 GB Healthy Boot
Volume 3 D Backup B NTFS Partition 232 GB Healthy
Volume 4 E Removable 0 B No Media