Fix Corrupt Windows System Files Using DISM

Posted on by Russell Smith in Windows Client OS

In this Ask the Admin, I’ll show you how to fix corrupt system files when System File Checker isn’t up to the job.

 

 

Windows 10 has proven to be the most reliable version of Windows yet. But that doesn’t mean that it’s completely immune from file corruption. If your Windows installation is exhibiting strange behavior or performance problems, it’s possible that corrupt system files could be causing the issue.

Before running any of the commands below, check the Event Log to see if anything unusual is going on. Other things worth checking out are disk health, using the chkdsk command, free disk space, and performing a clean boot to ascertain whether third-party drivers or applications might be the root of the problem. Microsoft has a guide to clean booting Windows 10 here.

Hard Disk Integrity

To verify the integrity of the system disk, first run a scan using chkdsk. If the system disk is labeled C:, which it is in most cases, the command would look like this:


Don’t forget to make sure you open the command prompt with elevated privileges. Type cmd in the search box in the bottom left of the taskbar and then right-click Command Prompt in the list of results. Select Run as administrator from the menu. Enter an administrator username and password if prompted.

If the utility finds any errors, you can fix them by adding the /f switch:


Before using chkdsk to fix any errors, I recommend backing up any important data on the drive.

System File Checker

If you suspect that corrupt system files are causing issues in Windows, the first thing to do is to run a scan using System File Checker (SFC). Open a command prompt with administrator privileges and run the command as shown below:


Performing a complete scan of the system can take a considerable amount of time. Once the scan has finished, it will report that either it hasn’t found any problems, that it found some problems and was able to fix them, or that it found problems and wasn’t able to fix them while the system is online. If SFC can’t fix issues while the system is online, reboot the system in Safe Mode and run the command again. To boot Windows 10 in Safe Mode, see Microsoft’s instructions here.

Deployment Image Servicing and Management

Running System File Checker in safe mode isn’t a guarantee that it will be able to fix the problems. When SFC fails to clean up Windows, the Deployment Image Servicing and Management (DISM) tool can usually come to the rescue. Run the following commands in an elevated command prompt.


The first command uses the /Scanhealth switch to check whether the online image is repairable. The /Checkhealth switch then determines whether any corruption has been detected. Finally, if the image is repairable, you can use the /Restorehealth switch to repair Windows.

Using DISM to fix corrupt Windows system files (Image Credit: Russell Smith)
Using DISM to Fix Corrupt Windows System Files (Image Credit: Russell Smith)

 

In the example above, DISM uses Windows Update to replace any corrupt files when the /Restorehealth switch is specified. Alternatively, you can prevent DISM accessing Windows Update by using the /LimitAccess switch. But in this case, you’ll need to provide your own source for replacing any corrupt files by providing a path to a mounted WIM image using the /Source switch. This can be useful in scenarios where servers don’t have access to the Internet.


If you don’t specify the /Source switch, DISM will use the default location that’s configured for Features on Demand. For more information on configuring a default location for a Windows repair source, see Microsoft’s website here.

In this article, I showed you how to check the integrity of your PC or server’s system disk and use the System File Checker and DISM utilities to repair corrupt system files.

Follow Russell on Twitter @smithrussell.

 

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register