Learn What IT Pros Need to Know About Windows 11 - August 26th at 1 PM ET! Learn What IT Pros Need to Know About Windows 11 - August 26th at 1 PM ET!
Windows Client OS

Fix Corrupt Windows System Files Using DISM

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.

 

 

Sponsored Content

Read the Best Personal and Business Tech without Ads

Staying updated on what is happening in the technology sector is important to your career and your personal life but ads can make reading news, distracting. With Thurrott Premium, you can enjoy the best coverage in tech without the annoying ads.

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:

chkdsk C:

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:

chkdsk C: /f

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:

sfc /scannow

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.

DISM.exe /Online /Cleanup-image /Scanhealth
DISM.exe /Online /Cleanup-image /Checkhealth
DISM.exe /Online /Cleanup-image /Restorehealth

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.

DISM /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess

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.

 

Related Topics:

BECOME A PETRI MEMBER:

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

Register
Comments (1)

One response to “Fix Corrupt Windows System Files Using DISM”

  1. c_robertson

    You would think by now there would be a program/utility that would do the following

    Disk SMART check

    check disk

    dism scan health

    dism fix health

    sfc /scannow,


    I've created a batch utility that I run pretty often but this should be built in to windows

Leave a Reply

IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.

Register for Advanced Microsoft 365 Day!

GET-IT: Advanced Microsoft 365 1-Day Virtual Conference - Live August 24th!

Join us on Tuesday, August 24th and hear from Microsoft MVPs and industry experts about how to take advantage of Microsoft 365 at a technical level and dive deep into the features and functionality that will make your environment more secure and compliant.

RSVP Now

Sponsored By