Geeks in Phoenix

Geek Blog


How to check and repair system files in Windows 11

When it comes to repairing Windows-based computers, I always do one thing: check for corrupt system files. Corrupt system files can cause all sorts of problems, so here is how to check and repair system files in Windows 11.

How to check and repair system files in Windows 11

Repairing system files is not complex, but it can be time-consuming. Going through all of the steps outlined in this article can take several hours. Once you start a scan, you will have to allow it to complete, so be prepared to watch your computer work. And all of the links included in this article will open in a new window.

We first need to check the drive's file structure that the operating system is installed on. It is usually drive C:. For this, we will use the disk error checking program built into Windows 11.

There are a couple of different ways to run it (standard and advanced), but the most thorough way is by using the advanced method (see link below). It may take some time to run, but it is the most thorough error checking you can perform.

How to check your drive for errors in Windows 11

Now that we have checked the drive for errors, we must check for corrupted system files. For this, we will use the built-in System File Checker (SFC). Like most of the programs in this article, this program has to be run from an Administrative Command Prompt.

How to open a Command Prompt with Administrator privileges in Windows 11

SFC has multiple syntaxes and parameters you can use with it. Here are all of the syntaxes and parameters with examples of their use.

SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>] [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory> [/OFFLOGFILE=<log file path>]]

  • /SCANNOW - Scans integrity of all protected system files and repairs files with problems when possible.
  • /VERIFYONLY - Scans integrity of all protected system files. No repair operation is performed.
  • /SCANFILE - Scans integrity of the referenced file, repairs file if problems are identified. Specify full path <file>.
  • /VERIFYFILE - Verifies the integrity of the file with full path <file>. No repair operation is performed.
  • /OFFBOOTDIR - For offline repair, specify the location of the offline boot directory.
  • /OFFWINDIR - For offline repair, specify the location of the offline windows directory.
  • /OFFLOGFILE - For offline repair, optionally enable logging by specifying a log file path.

Examples:

  • SFC /SCANNOW
  • SFC /VERIFYFILE=c:\windows\system32\kernel32.dll
  • SFC /SCANFILE=d:\windows\system32\kernel32.dll /OFFBOOTDIR=d:\ /OFFWINDIR=d:\windows
  • SFC /SCANFILE=d:\windows\system32\kernel32.dll /OFFBOOTDIR=d:\ /OFFWINDIR=d:\windows /OFFLOGFILE=c:\log.txt
  • SFC /VERIFYONLY

System File Checker running in an Administrative Command Prompt inside of Windows 11
We want to check all of the Windows 11 protected system files, so type the following into an Administrative Command Prompt and press Enter.

SFC /SCANNOW

System File Checker results in an Administrative Command Prompt inside of Windows 11
Now four (4) possible results can appear when SFC is done scanning. They are:

Windows Resource Protection did not find any integrity violations.
All system files are acceptable, and you are good to go.

Windows Resource Protection could not perform the requested operation.
There may be another program preventing SFC from running. In this case, boot the system up into safe mode and run SFC from there.

Windows Resource Protection found corrupt files and successfully repaired them.
All system files are now correct, and you're ready to go. Just restart your computer to finalize the repairs. If you want to view the repair details, type the following into an Administrative Command Prompt and press Enter.

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"

It will create a text file on your desktop named sfcdetails.txt that has all of the details of the repaired files.

Windows Resource Protection found corrupt files but was unable to fix some of them.
If you received this message, you will need to repair the hidden Windows image. To do this, we will need to run the Deployment Image Servicing and Management (DISM) program.
Deployment Image Servicing and Management running in an Administrative Command Prompt inside of Windows 11
To restore the health of the Windows image, type the following into an Administrative Command Prompt and press Enter.

DISM /Online /Cleanup-image /Restorehealth

Once DISM finishes, run SFC /SCANNOW again. This time no integrity violations should be found. If, after several attemps at automatically repairing the corrupt system file(s) fails, you may have to fix them manually. To view the details of the files that could not be automatically repaired, type the following into an Administrative Command Prompt and press Enter.

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"

It will create a text file on your desktop named sfcdetails.txt. You will need to search through it and find what file(s) could not be repaired

How to manually repair corrupt system files

Note: To replace a corrupt system file, you must have a known good copy of the file(s) in question. A good file source is another computer or virtual machine running Windows 11. Since I do computer repair for a living, I have all of the versions of Windows that are still supported by Microsoft running inside virtual machines.

The first thing to do is note the location (path) and name of the file(s) that need to be replaced from the sfcdetails.txt file. Once you have another copy of the corrupt file(s), you will need to take administrative ownership of the file(s). To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt and press Enter.

takeown /f path\filename

Example: takeown /f C:\Windows\FileToBeReplaced.dll

Next, you will have to grant administrators full access to the file(s) being replaced. To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt and press Enter.

icacls path\filename /grant administrators:F

Example: icacls C:\Windows\FileToBeReplaced.dll /grant administrators:F

The third thing to do is copy the new file(s) and replace the corrupt one(s).To do this, modify the following command with the path\filename of the file you want to replace and then type it into an Administrative Command Prompt and press Enter.

copy path\filename path\filename

Example: copy C:\Temp\FileToBeReplaced.dll C:\Windows\FileToBeReplaced.dll

Troubleshooting Windows Update problems

Updated October 1, 2024

When it comes to repairing Windows computers, there are a couple of problems that I get a lot of help requests. One of them is when a computer cannot get updates to Windows. So here are a few of my favorite resources for fixing Windows Update.

Troubleshooting Windows Update problems

There are several reasons why Windows Update can fail. There could be corrupted files or folders; the different services that Windows Update requires are not starting, registry errors, etc. The following is a list of some procedures I use to repair Windows Update.

Remember to always restart your computer after running any of these procedures before trying Windows Update again.

Windows Update Troubleshooter

Windows 10 and Windows 11 have several troubleshooters built-in, including one for Windows Update. All of the Troubleshooters are located in Windows Settings. There are a few different ways to get to Windows Settings.

How to access the Windows Update troubleshooter in Windows 11

You can find all of the troubleshooters for Windows 11 in the Settings app. To get to the Settings app, do one of the following:

  • Left-click on the Start Windows logo menu and left-click on Settings (the gear icon)
  • Right-click on the Start Windows logo menu or press the Windows logo key Windows logo + X and select Settings from the Power User menu
  • Press the Windows logo key Windows logo + I

The Settings app should open with the Home category highlighted in the left-hand column. Left-click on the System category in the left-hand column, scroll down the right-hand column, select Troubleshoot, Other troubleshooters, and then left-click on the Run button on the right-hand side of Windows Update.

How to access the Windows Update troubleshooter in Windows 10

You can find all of the troubleshooters for Windows 10 in the Settings app. To get to the Settings app, do one of the following:

  • Left-click on the Start Windows logo menu and left-click on Settings (the gear icon)
  • Right-click on the Start Windows logo menu or press the Windows logo key Windows logo + X and select Settings from the Power User menu
  • Press the Windows logo key Windows logo + I

Once you open Windows Settings, select Update and Security, then Troubleshoot in the left-hand column. In the right-hand column, select Additional troubleshooters, then select Windows Update.

So if the Windows Update Troubleshooter (repair) did not fix the issue, you could attempt to reset the components that Windows Update uses. The following link gives complete instructions on how to manually reset the Windows Update components, plus some additional resources.

Reset Windows Update components

There is another way to reset the Windows Update components. The Reset Windows Update Tool is a script-based application that performs the same functions as the instructions above. Along with resetting Windows Update components, it can run Secure File Checker (see below), repair invalid registry keys, and repair the Windows system image using DISM (see below).

Reset Windows Update Tool

Check your drive for errors

If you have run the Windows Update troubleshooters (repair/reset) and Windows Update is still not functioning correctly, it's time to do some general system checks. Sometimes there can be an error(s) with the file system that does not allow the troubleshooters to fix the issue(s). I have had this problem many times before. There is nothing worse than feeling like a dog chasing his tail. At this point, check your drive for errors by running checkdisk.

Check your drive for errors in Windows 11

Check your drive for errors in Windows 10

Once you are done with a checkdisk, go ahead and rerun the Windows Update troubleshooter. First, run the repair troubleshooter and try checking for updates. If it doesn't fix it, run the reset troubleshooter. If Windows Update still won't work, then it is time to check system files.

Check system files

SFC

Windows has a built-in program called System File Checker (SFC) to check system files for corruption and incorrect versions. SFC is run inside of an administrative command prompt. Just follow the link below for your version of Windows for instructions on how to bring up an admin command prompt.

Open an Administrative Command Prompt in Windows 11

Open a Command Prompt with Administrator privileges in Windows 10

SFC is the same in all of the currently supported versions of Windows. Here is the link to the most detailed instructions for SFC (Windows 10, Windows 11).

Check Windows 11 system files with System File Checker

Check Windows 10 system files with System File Checker

Once you are done running SFC and have corrected any problems it may have found, try running Windows Update. If it still doesn't work, try running the troubleshooters (repair/reset) one at a time, running Windows Update in between. If you again cannot run Windows Update successfully, it may be time to run the most advanced system corruption repair tools.

DISM

Deployment Image Servicing and Management (DISM) is the complete way of checking for file corruption in Windows. The link to the instructions on how to run it is below. DISM is meant to be used by advanced users, so if you don't feel comfortable running this program, please contact a local computer repair shop like Geeks in Phoenix for assistance.

Fix Windows Update errors by using the DISM

After running DISM, check again to see if Windows Update will work. If Windows Update still does not work, it may be time to perform a repair upgrade to Windows 10 / Windows 11.

How to perform a repair upgrade of Windows 11

How to perform a repair upgrade or Windows 10

Free computer diagnostics

Repairing a PC can sometimes be expensive, and that is why we offer free basic in-shop diagnostics. Give one of our professional and experienced technicians a call at (602) 795-1111, and let's see what we can do for you.

Check out our reviews

Geeks In Phoenix LLC, BBB Business Review

Customer service is #1

Here at Geeks in Phoenix, we take pride in providing excellent customer service. We aim to give the highest quality of service  from computer repair, virus removal, and data recovery.

Bring your computer to us and save

Repairing a computer can be time-consuming. That is why we base our in-shop service on the time we work on your computer, not the time it takes for your computer to work! From running memory checking software to scanning for viruses, these are processes that can take some time.

Contact us

If you have any questions, please feel free to give us a call at (602) 795-1111  and talk with one of our Geeks. Or you can send us a message from our contact page , and one of our Geeks will get back to you as soon as possible. Or you can stop by and see us. Here are our hours and location.

Like Geeks in Phoenix on Facebook

Follow Geeks in Phoenix on Twitter

Watch Geeks in Phoenix on YouTube