This article briefly talks about SFC (System File Checker) and DISM (Deployment Image Servicing and Management). The aforementioned Windows tools, SFC and DISM will help you to scan, identify and fix Windows based file corruption issues. We will go through the function of each tool and will also look at the common commands to use them.
What is SFC – System File Checker?
As the name suggests, you can use the SFC tool to scan and restore corrupt system files in Windows. SFC is part of Windows Resource Protection (WRP) since the release of Windows Vista.
What does SFC do?
The SFC utility allows windows administrators to scan all the protected resources in the Windows Image to verify their versions. SFC scans the operating system files that are critical to the windows restart process and replaces them if the version of the file does not match the correct version.
What is a Windows Image?
A Windows Image is a group of file, components, settings, and packages (Module is a single file with code and package is a group of modules) that collectively form the Windows Operating System. It is a representation of the data present on your operating system hard drive i.e. C:\ usually.
What are the types of Windows Images?
We have 2 types of Windows Images available, Online Image and Offline Image.
- Online Image: An online image is an image that you can boot into, i.e. the Operating system is bootable and online.
- Offline Image: An offline image is not a running instance of Windows Operating System and cannot be logged onto. An Offline image can have the following file formats / extensions:
- .wim (Windows Image)
- .ffu (Full Flash Update)
- .vhd (Virtual Hard Disk)
- .vhdx (Virtual Hard Disk v2)
What is Windows Component Store in Windows?
The source that SFC utility uses to copy the files from is the known as the Windows Component Store and the location of Windows component Store is as follows:
%WinDir%\WinSxS
Command to run SFC – System File Checker?
Click on the Start button to open Command Prompt as Administrator and run the following command:
sfc /scannow
Click here to read more about SFC - System File Checker from Microsoft
What is DISM – Deployment Image Servicing and Management?
DISM (Deployment Image Servicing and Management) is a command-line tool that you can use to service Windows Online and Offline Images. You can use the tool to install, uninstall, configure, and update various Windows features, packages, drivers, and international settings.
By default, DISM command uses Windows Update (WU), which is an Online Source for repairing online images.
Here is the subset of the DISM commands that you can use to service an Online Image and fix the Component Store corruptions in the image:
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
DISM Command Explanation
Online: This option is used for Image Specification. The Online Switch in the DISM command instructs the tool to service the running operating system on your local machine.
Cleanup-Image: The Cleanup-Image Switch in the DISM command instructs the tool to performs cleanup and recovery operations on the target image selected in the previous switch i.e. Online (OS running locally) Or an Specific Mounted Offline Image.
CheckHealth: The CheckHealth Switch in the DISM command check if any failed process has marked the image corrupt, and, this switch also checks whether the corruption is repairable or not.
ScanHealth: The ScanHealth Switch in the DISM command checks for Component Store corruption and hence this command can take several minutes to complete.
RestoreHealth: The RestoreHealth Switch in the DISM command checks for Component Store corruption and performs the repair operation automatically. Since the DISM check the Component Store, this command can take several minutes to complete.
How to run the DISM command without Internet?
Use the following command to run the DISM command when internet is not available:
Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess
Offline Source (Without Internet) command explained
LimitAccess: This switch prevents the DISM command from using the Windows Update (WU) as its source for repairing the Corrupt Component Store.
Source: This switch specifies the source to be used for repairing the Corrupt Component Store instead of using Windows Update (WU).
Click here to read more about the DISM commands listed above on Microsoft site
Click here to read more about DISM - Deployment Image Servicing and Management from Microsoft
What should your run first, SFC Or DISM?
A very common question that comes across while fixing file corruption issues in Windows operating system is what should you run first SFC Or DISM.
We would recommend to run SFC first followed by DISM and SFC again. This sandwich approach is very effective wherein we check the System files first by running the SFC command. Then, we would run the DISM to fix any Component Store corruptions. And finally, we would again run the SFC command to fix system files corruptions, if any.
What is Windows Resource Protection?
WRP (Windows Resource Protection) is a tool/mechanism that Windows operating systems uses to prevent the unauthorized replacement of Protected Resources. Protecting the important resources prevents application and operating system failures.
What are Protected Resources?
Protected Resources are the important files, folders and registry keys in Windows Operating system that WRP protects.
What does Windows Resource Protection do?
WRP protects Protected Resources by defining an Access Control List (ACL) for the aforementioned Protected Resources.
Only TrustedInstaller, the built-in user account, has full-access permission to modify the files, folders and registry keys that the Windows Resource Protection protects.
Click here to read more about Windows Resource Protection from Microsoft