How to restore the component store (system image) of Windows 11

To check the integrity and restore system files using the sfc /scannow command, or to perform a factory reset of Windows 11, files from the system image or component repository are used. In some cases, this storage can get corrupted, in which case you may get error messages like “Windows Resource Protector detected corrupt files, but cannot restore some of them” when using sfc or “The component store needs to be restored”, “Error 14098 Component store is corrupt", "DISM failed. Operation failed” or “The original files were not found. Specify the location of the files needed to restore the component using the Source» parameter when working with DISM.

This step-by-step tutorial details how to restore the Windows 11 component repository using online restore or system image files.

Easy retrieval of the component repository at the command line or in PowerShell

The standard way to check if the Windows 11 component store can be restored and restore it is to use command line commands. The procedure will be as follows:

  1. Run the command line as administrator (How to run the command line as an administrator in Windows 11).
  2. Enter the command
    Dism / Online / Cleanup Image / ScanHealth
  3. The result of executing the command can be a message that no component store corruption has been detected (in which case recovery is not necessary) or that the component store needs to be recovered.
  4. In the second case, you can use the command
    Dism / Online / Cleanup Image / RestoreHealth

    to start the recovery process. Note: the recovery process may "freeze" at certain times, please be patient.

  5. When the recovery process has completed successfully, the message “Recovery was successful” should appear. The operation has been completed successfully.

The same commands can also be used in PowerShell as an administrator (it opens in "Windows Terminal" by default, in this case they will be the following:

Repair-WindowsImage -Online -ScanHealth Repair-WindowsImage -Online -RestoreHealth

Unfortunately, recovery using the described method does not always go smoothly. If this is the case, you can use a system ISO image as the source of the original files to restore the component repository.

The second way to simply restore a system image

If you're not ready for the methods described below (which require some understanding of what's going on), you can use a very quick method to restore the component repository, similar to a system reinstall, but with all data and programs intact . The method will work for "standard" Windows 11 Home or Pro and may not work for different types of "builds". It also requires your computer to be compatible with Windows 11.

Necessary steps:

  1. Download a Windows 11 ISO image from the official website and mount it on the system.
  2. Run setup.exe from the downloaded image.
  3. After a period of checking for updates and license acceptance, on the “Ready to Install” screen, click “Install” and wait for the installation to complete.

The process will take a long time, files and programs will be saved, but system files in the component repository will be overwritten. You may need to delete the Windows.old folder after using this method.

How to restore component store using Windows 11 ISO image

To follow the steps below, you will need to download an ISO image of Windows 11 with the same version of the operating system installed on your computer and connect it to the system (right click – connect).

Next steps:

  1. In the connected image, in the fonts folder, locate the file install.esd o install.wimThe file path will be used below.
  2. At the command line, use the following command (changing the installation file path to the actual path, in my case it is E:\sources\install.esd):
    Dism /Get-WimInfo /WimFile:E:\sources\install.esd
  3. This will result in a list of editions of Windows 11 on the image. You will need an index of the edition of Windows installed on your computer.
  4. Use the command
    Dism /Online /Cleanup-Image /RestoreHealth /Source:E:\sources\install.esd:индекс /LimitAccess

    where you need to replace the installation file path with your own and the index with the index of the corresponding Windows 11 edition.

Wait for the restore process to complete, it may be successful this time.

Read More: How to add third-party repositories and RPMs in Fedora

Restore system file storage from bootable flash drive Windows 11

If a system problem prevents you from restoring component storage, the process ends with a "DISM Failed" message. Operation Failed” or other problems arise, you can try recovery using a bootable flash drive.

  1. Create a bootable Windows 11 flash drive and boot from it.
  2. The installer will start, press the keys Shift+F10 (sometimes Shift+Fn+F10) to start the command line.
  3. At the command line, in order, use the commands
    diskpart list volume exit

    to determine the system drive letter (may be different from C when booting from a USB stick).

  4. Get the details of Windows editions on the flash drive using the command
    Dism /Get-WimInfo /WimFile:полный_путь_к_файлу_install

    The install.esd or install.wim file is located in the sources folder on the USB stick. You will need the index of the edition of Windows installed on the computer. For example, in my case, Windows 11 Pro is installed and I see that it is index 4.

  5. Use the command
    Dism /Image:C:\ /Cleanup-Image /RestoreHealth /Source:полный_путь_к_файлу_install:индекс

    to start recovery. If the system drive letter is different from C:, substitute it in the command.

  6. If there is an error like "There are not enough memory resources to complete the operation", change the command as follows:
    Dism /Image:C:\ /Cleanup-Image /RestoreHealth /Source:полный_путь_к_файлу_install:индекс /ScratchDir:E:\

    where the last parameter specifies where the temporary files will be stored when executing the command, mine is drive E. Do not use the system drive path as temporary file storage (you will most likely be told that you cannot access to the temporary directory for it).

Wait for the recovery to complete and wait for the message: “Recovery was successful. The operation has been completed successfully.

Read More: How to install Kodi add-ons from repositories

From an uncompressed system image to a virtual drive

You can use the following recovery method, which works both on the command line running from a bootable flash drive, and on a working system. Procedure:

  1. Attach a Windows 11 ISO image in case the procedure is done on a working system.
  2. At the command line as an administrator, create, mount, and format the virtual drive and assign it a letter. The commands will be as follows (in my case, drive partition E is used to create the drive, and the connection letter is Z, you must use a drive partition that has enough free space):
    diskpart create vdisk file=E:\virtual.vhd type=expandable maximum=20000 attach vdisk create partition primary format fs=ntfs quick assign letter=Z
  3. As with the previous methods, determine the index of the desired edition of Windows 11 using the command
    Dism /Get-WimInfo /WimFile:полный_путь_к_файлу_install
  4. Extract the image to the created virtual disk (in my case under the letter Z), the process can take a long time:
    Dism /Apply-Image /ImageFile:полный_путь_к_файлу_install /index:индекс_образа /ApplyDir:Z:\
  5. Use the following command to start the recovery process (here E: is the partition to store temporary files)
    Dism /image:C:\ /Cleanup-Image /RestoreHealth /Source:Z:\Windows /ScratchDir:E:

    in the event that the restore is performed from a working system, specify /Online instead of /image:C:\

After completing this method, unmount the virtual drive: on a working system, just right-click on it in Explorer and select “Unmount”, then you can delete the file itself from the virtual drive. virtual drive. In my case, E:\virtual.vhd