How to use the SFC and DISM commands to repair Windows

Requirements

  • Windows 8 or newer
  • Windows Server 2012 or newer

Introduction

Any version of Windows, over time, may begin to exhibit abnormal behaviour: slowdowns, blue screens, applications that do not open or operating system functions that suddenly stop working. Often these problems are caused by corrupt or missing system files. To solve these problems, Windows integrates two powerful tools to diagnose and repair damaged components: SFC (System File Checker) and DISM (Deployment Image Servicing and Management). Using them can often solve many problems without having to reinstall the operating system.
In some extreme cases, the operating system may be particularly corrupt and the correct restoration of components is not guaranteed by these two tools.

What are SFC and DISM commands?

SFC – System File Checker

The SFC command performs a complete scan of protected Windows system files, and if it finds corrupt or missing files, it automatically replaces them with a corrected copy stored in the local cache.

DISM – Deployment Image Servicing and Management

The DISM command works deeper than SFC, it is used to manage and repair the Windows image used to install or restore system components. It is particularly useful when the System File Checker fails to correct problems because the image from which it is supposed to retrieve the correct files is also damaged.

How to run the DISM command

  1. Open the Windows Start menu and type cmd, right-click Command Prompt and select Run as administrator.
  2. In CMD type the following command and press ENTER:
    DISM.exe /Online /Cleanup-image /Scanhealth
    When finished, the status of the system image will be reported and whether there are any Windows components to restore;
  3. If there are any components that can be restored by the previous command, type the following command and press ENTER:
    DISM.exe /Online /Cleanup-image /Restorehealth
    At the end, a message will be displayed on the success of the operation and if it worked correctly, the Windows components have been restored.

How to run the SFC command

  1. Open the Windows Start menu and type cmd, right-click Command Prompt and select Run as administrator.
  2. In CMD type the following command and press ENTER:
    sfc /scannow
    When finished, you will see the status of your system files and whether they have been successfully restored.

Conclusion

At the end of the two procedures described, the Windows components will have been correctly restored and any errors in the operating system image will have been corrected. In the event that the operating system contains too many errors, it may happen that these tools are not able to remedy them and that it is therefore necessary to restore Windows.

By Giacomo

System Administrator. Founder and writer.