If your Windows system is acting weird or is unbearably slow, the first thing you need to do is scan and remove any viruses or malware. Apart from that, the other reason might be the corrupted system files. There are a variety of reasons why system files get corrupted, like a sudden power failure, system crash, errors while updating, version mismatch, etc. No matter what the reason is, if you ever think your system is slow or the system files hvee been corrupted, here is how you can scan and fix corrupted Windows files using the DISM (Deployment Image Servicing and Management) command line tool.
Note: I’m using Windows PowerShell to scan and fix the problems. However, you can also use the Command Prompt with the same exact commands and procedures discussed below.
Scan for Corrupted Windows System Files
To start, search for PowerShell in the Start menu. Right-click on it, and then select the option “Run as administrator.” This action will open the Windows PowerShell.
In the PowerShell window copy and paste the below command. This command invokes the Windows Resource Protection to check for any file corruptions or violations. The scan may take some time to complete, so sit back and wait for the results.
sfc /scannow
Once the scan is completed, it will display a message something like what is show below if there are any problems. Windows tries to fix them by itself, but more often than not it fails to do so. Continue on to the next step.
Fix Corrupted Windows System Files
If the SFC command didn’t fix the problem, then we can use the DISM tool with RestoreHealth and Source switches. To start, copy the below command, and execute it in the PowerShell.
Dism /Online /Cleanup-Image /RestoreHealth
As soon as you execute the command, Windows starts the process of fixing it. While fixing it, the progress bar may get stuck at 20%. This is normal. Just wait for a while for the process to continue. If the command fixes the problem then that’s good. If not, continue on. In my case Windows failed to fix the problem. If you want to know what the actual error is, open the DISM log from the location displayed in the Powershell.
Now, we are going to use the /Source
switch where we point the DISM tool toward the Windows installation media so that it can fix the problem using the source files. Insert your installation media, be it a DVD or USB driver. If you don’t have the installation drive, download the latest Windows ISO from Microsoft and mount it (right-click on ISO and select the option “Mount”).
Once you’ve done that, execute any one of the below commands. Don’t forget to replace “X” with the actual drive letter of your Windows installation media.
Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:X:\sources\install.wim:1
or
Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:X:\sources\install.wim:1 /limitaccess
The second command prevents DISM from using Windows Update for online images. If everything goes well, you will see a message reading “restoration operation completed.” Just like before, it may take some time to complete the procedure.
Now, again use the SFC command so that Windows can fix any minor problems.
sfc /scannow
When the procedure has been completed, you will see a message like the one below.
If you scan again with the sfc
command, you should see a message like the one below. This confirms that there are no more file corruptions or violations.
Do comment below sharing your thoughts and experiences about using the above methods to scan and fix corrupted system files in Windows.
Our latest tutorials delivered straight to your inbox