How to Repair Windows 11 with SFC and DISM

Punniya seelan
0

 If your operating system doesn't work properly, you can repair Windows 11 with SFC and DISM. These are two now-classic tools that are familiar to many advanced users. Here is how to use them.

ADVERTISЕMENT

The sfc /scannow command checks integrity of protected system files. If some of them is corrupted or missing, SFC will replace it with correct versions when possible. Also, the tool is able to detect when a file has been overwritten with a modified or older version.  In this case, it will retrieve the correct version of the file from the Windows Component Store, and then replace the modified file.

DISM is another great tool to fix Windows 11 issues. DISM stands for Deployment Imaging and Servicing Management. If a Windows image becomes unserviceable, you can use the DISM command or its Repair-WindowsImage PowerShell counterpart to update the files and fix the problem.

Let's start with SFC and learn how to properly run it in Windows 11.

Repair Windows 11 with SFC /SCANNOW

You can start the sfc /scannow command in Windows 11 from any available console, such as the classic command prompt, PowerShell, and Windows Terminal. If Windows 11 doesn't start, you can go with a command prompt open at boot. The latter is also known as an offline scan. Finally, the check result will be written to a special file, CBS.LOG.

Run the SFC /SCANNOW command

  1. Open a new Windows Terminal as administrator; press Win + X and select Windows Terminal (Admin).Open Windows Terminal As Administrator
  2. Select the Command Prompt or PowerShell profile from the down arrow chevron menu.Select Command Prompt Or Powershell In Windows Terminal
  3. Type or copy-paste the sfc /scannow command, and press Enter.Repair Windows 11 With SFC
  4. Wait for the scan to complete. It may report that Windows Resource Protection did not find any integrity violations, or that it found corrupt files but was unable to fix some of them.
  5. If there's no errors, you can close the console now.

SFC found corrupt files but was unable to fix some of them

If after you checked system files with SFC, and it reports that "Windows Resource Protection found corrupt files but was unable to fix some of them.", here are the steps to take.

  1. Run the sfc /scannow command again. Sometimes it is required to run it up to 3 times, and restart the computer after each check. Also, try to disable Fast Startup, restart Windows 11, and start perform the sfc check.
  2. If doesn't help, do a Component Store repair with the dism /Online /Cleanup-Image /RestoreHealth  command (reviewed below in this article). Then restart the computer, and try one more time with sfc /scannow.
  3. If all the above fails, try to restore your computer from a restore point if available.
  4. if no restore points available, repair install Windows 11(in-place upgrade).
  5. Finally, if In-place Upgrade also doesn't help, you should reset Windows 11.

Repair Windows 11 with offline SFC scan at boot

  1. Open a new command prompt at boot.Open Command Prompt At Boot In Windows 11
  2. Type diskpart and press Enter.Run Diskpart At Boot
  3. In diskpart, type list volume and see the recovery boot partition drive letter (it is around 500 MB) and the Windows 11 system drive letter. Make note the letters, e.g. E: is the recovery partition, and C: is the system partition.
  4. Type exit to leave diskpart.
  5. Now, type the sfc /scannow /offbootdir=<recovery boot partition drive letter>:\ /offwindir=<Windows 11 system partition letter>:\Windows. Replace the letters with the drive letters you previously noted.Repair Windows 11 With SFC At Boot

You are done. See the command output to check if errors were fixed or not.

View SFC Scan results from the CBS.LOG file

When performing a system file check under Windows (not offline scan!), the SFC tool adds entries to the C:\Windows\Logs\CBS\CBS.log file. Using them, you will be able to find what has happened during the last scan. You can quickly fetch them in the command prompt or PowerShell.

To view SFC Scan results from the CBS.LOG file, open Windows Terminal (Win + X > Windows Terminal) with Command Prompt or PowerShell, and type one of the following commands.

For the Command Prompt profile:

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfc.txt"​

For PowerShell:

(Select-String [SR] $env:windir\Logs\CBS\CBS.log -s).Line >"$env:userprofile\Desktop\sfc.txt"​

This will filter the contents of the CSB file, and extract the lines related to the SFC tool to the sfc.txt file on your Desktop. Open it with Notepad and see its contents. It will help you to find what files are broken and were/weren't fixed.

CBS.LOG File For Sfc Scan

Repair Windows 11 with DISM

DISM comes into play when the SFC tool fails to fix a serious corruption of the OS. It can use the Internet and Windows Update to retrieve actual file versions. Also, you can make it use a local (offline) install.wim/install.esd file from an ISO file or bootable media with Windows 11. However, before doing any repair procedure, you much check integrity of the Windows Component Store, i.e. to check its health.

Check Health of Windows Component Store with DISM

  1. Open a new elevated Windows Terminal.
  2. If your Windows Terminal opens to a command prompt, issue the command: dism /Online /Cleanup-Image /CheckHealth.Dism Check Health Of Windows Component Store
  3. Alternatively, select a PowerShell profile, and execute the command Repair-WindowsImage -Online -CheckHealth​.PowerShell Check Health Of Component Store
  4. Any of the above commands will report the Component Store state,  e.g. healthy, repairable, or non-repairable.

Here is what the Windows Component Store status means.

Windows Component Store statuses

Healthy - DISM didn't detect any component store corruption. No repair required; Windows 11 is operating normally.

Repairable - you need to repair a Component Store corruption. The next two chapters in this post explain the procedure in detail.

Non-repairable - Windows 11 can't fix its Image Component Store. You have to either repair install Windows 11reset, or clean install Windows 11.

Here's how to repair Windows 11 using DISM.

How to Repair Windows 11 with DISM using Windows Update

  1. Open Windows Terminal as Administrator.
  2. For the Command Prompt profile, type the following command and hit Enterdism /Online /Cleanup-Image /RestoreHealth.Repair Windows 11 With DISM
  3. For PowerShell, issue the following command: Repair-WindowsImage -Online -RestoreHealth​.Repair Windowsimage Powershell Cmdlet
  4. Wait the process to finish, and close the Windows Terminal app.

Finally, If you have no Internet connect or your data plan is limited, you can make dism use an install.wim or install.esd file as a source of the system files for the Windows Component Store. Here's how to do it.

Repair Windows 11 with DISM using Install.wim

  1. Double-click your Windows 11 ISO file, or connect your bootable USB stick.
  2. Make note the letter of its drive, e.g. G:.
  3. Open a new Windows Terminal as Administrator, and run the dism /get-wiminfo /wimfile:G:\sources\install.wim command. Replace the drive letter with a proper value, and install.wim with install.esd if your media includes an ESD file instead of WIM.
  4. In the output, find and note the index of the Windows 11 edition that matches your currently installed OS.Get Edition Index From Wim
  5. If your Windows Terminal is open to PowerShell, execute the command Repair-WindowsImage -Online -RestoreHealth -Source "<Drive Letter>:\sources\install.wim:<Index>" -LimitAccess. Replace <Drive Letter> and <Index> with the appropriate values.
  6. Alternatively, you can use the following command in both PowerShell and Command Prompt: dism /Online /Cleanup-Image /RestoreHealth /Source:wim:<Drive Letter>:\sources\install.wim:<Index Number> /limitaccess​.Repair Windows 11 With DISM Using Install.wim
  7. Wait for the process to complete.

That's all about how to repair Windows 11 with SFC and DISM.

Post a Comment

0Comments

Post a Comment (0)