How to restore windows components. How to fix errors when installing Windows updates using built-in component repair

How to restore windows components.  How to fix errors when installing Windows updates using built-in component repair
How to restore windows components. How to fix errors when installing Windows updates using built-in component repair

I haven't written anything related for a long time exclusively to Windows 7. The reason for today’s entry was a rare case - Microsoft added new opportunity to the old OS retroactively!

Experienced readers will immediately remember how, four years after the release of Windows 7, it became possible to empty the WinSXS folder. Then some of the DISM functions were transferred from Windows 8+. Two years have passed, and another technology related to component storage has moved into Windows 7.

Today on the program

Returning to print

From it you will learn:

  • Windows Maintenance Basics
  • steps to restore components in Windows 8+
  • difference between old CheckSUR in Windows 7 and built-in recovery in Windows 8+

What's new in Windows 7 :)

Microsoft has published knowledge base article KB2966583, from which you can download the update package. After installing it and rebooting, Windows 7 gets virtually the same ability to restore components as Windows 8+.

As in newer operating systems, recovery is implemented with using DISM. The following command starts the process of checking the repository and repairing damaged components.

DISM /Online /Cleanup-Image /ScanHealth

However, Windows 7 has a number of features:

  • there are no keys here /CheckHealth And /RestoreHealth, and the key does all the work /ScanHealth
  • The command can only be executed on a running system, i.e. Restoring disabled images is not implemented
  • it became possible to check and restore components Internet Explorer, which was not in the old CheckSUR

The result of the command should be viewed in the log, as before, saved at \Windows\logs\CBS\checksur.log

================================= Checking System Update Readiness. Binary Version 6.1.7601.18489 2015-07-27 12:32 Checking Windows Servicing Packages Checking Package Manifests and Catalogs Checking Package Watchlist Checking Component Watchlist Checking Packages Checking Component Store Summary: Seconds executed: 149 No errors detected

I didn’t find any damage on my VM, but you can check it yourself.

The knowledge base article specifically mentions the ability to create a scheduled task to run a command. However, please note that to run DISM you need administrator rights, i.e. the task will not run under a regular account.

Discussion and poll

If you have questions or comments on the topic of component recovery, feel free to voice them in the discussion. Please do not publish the checksur log in the text of the comment - there is PasteBin.

However, I think that there will be few of them, so I want to turn the discussion into a different plane. There are only a couple of days left until the official release of Windows 10. There are no surprises for insiders and enthusiasts - we have been monitoring the progress of OS development for eight months now. It is clear that almost all Windows 8.1 owners will upgrade to Windows 10.

So I'm particularly interested in how many people are willing to upgrade to Windows 10 from Windows7 and earlier OSes.

I already did a survey on the speed of upgrading to Windows 10, but there was no breakdown based on your current system, and now we'll see it. If Windows 10 IP is your primary current system, indicate the one that was installed before it.

Write in the comments why you will or will not switch to Windows 10! Don't forget to indicate how long and how you used the preliminary Windows version 10.

Is it possible to restore a completely destroyed/deleted storage, WITHOUT reinstallation the whole system?

The client is completely clogged system disk and it seemed that WinSxS took up a lot of space, and was removed.
In fact, in a freshly installed Win10, deleting 5.5 GB of WinSxS frees up only ~380 MB. Everything else is hard links.
What then is stored there?і

I wanted to restore by installing from the install.wim image, and selecting " Update with saving files", but then a proposal to restart the computer and continue the restore. Why continue - return points and system images were not created.
That. There is NO option to restore by installing from disk?

Then I replaced all the WinSxS from boot.wim and Win10 started to run normally. It became interesting, and I checked: everything runs in 32bit Win10, but 32bit applications do not run in the 64bit Win10 system.

But you still need to restore the storage completely. Then I came across your site.

By the way, in the Win10 I was restoring, there is no powershell at all, neither in Search, nor in the Start_Menu, nor in the Control Panel, although there is a directory \Program Files\WindowsPowerShell, but nothing could be launched there. I thought about finding and installing powerhel,l, but after spending 30 minutes I could only find manuals, so I stopped wasting time.

Then I simply inserted powershell into the Adnin.cmd window and got it. You are missing this simple way to open powershell

So far I have tried without success to restore the storage completely, and in a working system with stripped-down WinSxS:
------
>
>
DISM system
Version: 10.0.10240.16384
Image version: 10.0.10240.16384
[==========================100.0%==========================]
Error: 0x800f081f
The source files could not be found.
Specify the location of the files needed to restore the component using the Source option.
------

And in powershell
>

line:1 character:1
+ Repair-WindowsImage -Online -RestoreHealth
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------
and from other running systems:

>

Repair-WindowsImage: The system cannot find the specified path.
line:1 character:1
+ Repair-WindowsImage -Path e: -RestoreHealth -Source R:\sources\instal ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo: NotSpecified: (:), COMException
+ FullyQualifiedErrorId: Microsoft.Dism.Commands.RepairWindowsImageCommand

with the same success. Maybe I'm doing something wrong?

I read above about the same refusals, and I also want to get to the bottom of the truth. To do this, I installed Win10 in a 12GB vhd image - I’ll lock up one copy and move on to another.
By the way, can you advise how and how to compare the speed of the system from the vhd image and from the disk.

I only deal with pirates, but everything described worked fine on other Win10s. Even for example, from ru_windows_10_enterprise_2015_ltsb_x64 to Win10ProRU downloaded yesterday from the update center and back. Incl. The problem is not with pirates, but somewhere in broken identification files.

And how is it correct in this case: “Use the ISO image of Windows”?

P.S. After copying the entire WinSxS from the 64bit Win10 image installed in the vhd from yesterday downloaded to the destroyed Win10, everything starts and works.
But the above checks do NOT work.

I also read your useful articles, but so far it has not been possible to completely fix the system with “touched” WinSxS. Apparently something is changing in the settings.

With a running or another OS:
>sfc /scannow
>sfc /scannow /offbootdir=C:\w10\ /offwindir=E:\Windows
Windows Resource Protection fails to start the repair service.

>Dism /Online /Cleanup-Image /RestoreHealth
>Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:R:\sources\install.wim:1 /limitaccess
>Repair-WindowsImage -Online -RestoreHealth
>Repair-WindowsImage -Path e: -RestoreHealth -Source R:\sources\install.wim -Debug -Verbose
>Repair-WindowsImage -Path e: -RestoreHealth -Source C:\w10\ -Debug -Verbose
DETAILS: DISM PowerShell Cmdlets Version 10.0.0.0
Repair-WindowsImage: The system cannot find the specified path.
line:1 character:1
+ Repair-WindowsImage -Path e: -RestoreHealth -Source C:\w10\ -Debug -V ...

I don't see any other combinations yet.

So is it possible to restore a destroyed/deleted storage either by restoring from the installation disk, or using commands?

And maybe you also know - for the *.vhd image, diskmgmt without choice creates Block_size 2MB, sector 512, and BOOTICE.exe for *.vhd Block_size 2MB, sector 512 (or 4096), and for *.vhdx it offers Block_size 32MB, sector 512 (or 4096).
It’s clear with the sector - 1/2 of the sector size is lost on each file, but fewer (large) sectors are easier to process.
But what is the effect and what is the optimal Block_size for Windows 10 images of 10-25 GB in size?

Thanks in advance for any information.

P.S.S. When I sent it for the first time, it pulled me out network cable and the sending was stuck. I inserted the cable, looked - my post was not there, then I repeated it. And now I’m adding, and I see 2 posts. Please remove the first one.

After adding full WinSxS, powershell appeared in Search

Having problems with Windows 10 and can't fix them? Are your system files damaged and the traditional sfc /scannow command is not working? See how to use the DISM feature to fix corrupted system files or restoring them from the original system image without rebuilding Windows installations 10.

As a rule, in case of problems with system files, use the SFC utility, which scans HDD for errors and corrects them. But still, this first aid remedy does not always bring the desired results. Another DISM utility is available in the system, which we briefly mentioned in previous articles, which can fix problems with damaged files in Windows 10. This time we will look at the full range of DISM functions, describe various use cases and show how to use it to restore damaged system files from the original system image (component storage).

This feature is designed to patch and prepare WIndows images such as OS boot disk, system recovery tools, etc. These images can be used to reinstall or restore the system in case of problems. When using the SFC utility to scan and repair a disk, problems with damaged files can only be resolved using the appropriate image from the component store on the hard drive. When this image is damaged, the system cannot retrieve system files from the component store and therefore cannot restore them using the SFC function. It is in this case that the DISM utility will help us, which will solve the problem with recovery images and allow the SFC function to complete its work correctly.

How to use DISM utility?

Restoring system files using the utility is not difficult. With this application you can restore components using the same principle as using SFC via the command line. To call command line press combination Windows keys+ X and in the menu that appears, select “command line (administrator). Then in the console you need to enter the DISM command with the appropriate parameters.

We can add to the DISM command Extra options, with which you can check, scan and restore images different ways. Let's look at the most important combinations.

DISM with CheckHealth parameter

In the command line console, enter the following command:

DISM /Online /Cleanup-Image /CheckHealth

Using this option, you can quickly check the image and individual components of the system installation that are stored on the disk for damage. This command does not make any changes - it is completely safe. CheckHealth provides information about the status of the operating system package. This is very useful option when we want to safe way check if any system file corruption has occurred in the component store.

DISM with ScanHealth option

This option works similar to CheckHealth, but takes a little longer due to a more thorough scan, but also does not fix anything. It is worth using when the previous /CheckHealth option indicated that everything is fine, but we want to make sure that this is definitely the case. Enter:

DISM /Online /Cleanup-Image /ScanHealth

The scan may take much longer than with the previous option (approximately 10 minutes). If the scan stops at 20% or 40%, you will need to wait - it may seem like your computer is frozen - but it is actually scanning.

DISM with RestoreHealth option

If the first and second commands unloaded a message that the images were damaged, it is time to restore them. For this purpose, we use the /RestoreHealth parameter. Enter the following command in the command prompt console:

DISM /Online /Cleanup-Image /RestoreHealth

Parameter uses center Windows updates recovery damaged files in the component repository. Scanning procedure and automatic recovery may take approximately 20 minutes (sometimes more). DISM detects a failure, creates a list of damaged files, and then downloads them from Microsoft servers using Windows Update.

How to restore files from a specified source using the RestoreHealth option

Sometimes it happens that damage to the operating system is much wider and affects the Windows Update service. In this case, the RestoreHealth parameter will not be able to repair damage to the image because the system cannot connect to Microsoft servers. In this situation, you should perform another operation - specify the path to the Windows installer, from which “working” files will be downloaded without using the Internet and the update center.

To do this, you need the Windows 10 installer on a DVD, flash drive, or ISO image format. The latter can be downloaded via the app Media Creation Tool for Windows 10.

Download the version for Windows 10 (32 or 64 bit), run the application and follow the wizard to download the ISO to your computer. After the image is downloaded and saved, go to the Explorer window and double-click on the ISO file with the installer to mount it. In the This PC window, check which letter was assigned to the mounted image (for example, the letter "E").

If you have a bootable DVD disc or USB drive With Windows installation 10, then you don’t need to download anything - just insert the disk or connect external media, and see what drive letter was assigned to this drive in the “This PC” section.

After the drive with the Windows installation is detected by the system and we know the letter, it is time to use the appropriate DISM parameter, which will indicate the path to this media. To do this, enter the following command:


Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:E:\Sources\install.wim:1 /limitaccess

Please note again that if in our case, a DVD, flash drive or ISO image If a different letter is assigned than “E”, then change it in the above command. After pressing Enter, damaged component store files will be restored from the original Windows installer along the specified path.

Fixing errors in Windows

Once you have completed all the above steps, you now need to use the SFC utility again to fix errors in the system from the restored Windows images. Type in the command prompt window:

sfc /scannow

Sometimes it may be necessary to scan the system three times to completely eliminate all errors. SFC now has access to restored images in the component store and can completely restore damaged system files.

If the performance of your computer has decreased significantly, but the SFC utility could not solve the problem, you should use the DISM system tool to restore the Windows image.

Windows 10 includes useful utility command line called Deployment Image Servicing and Management (DISM). This tool appeared in Windows Vista. In Windows 10 and Windows 8.1, the DISM tool is installed by default.

The utility can be used to restore and prepare Windows images, including the environment Windows recovery, Windows Installer and Windows PE. DISM can also be used to repair a system recovery image using the current OS installation and even to maintain a virtual hard disk.

If errors keep appearing on your computer and you begin to notice problems during boot, you can use the System File Checker ( System File Checker, SFC) to analyze the integrity of system files and replace damaged or missing files with a working copy.

If the SFC utility cannot fix the problem, then most likely the tool was unable to obtain the necessary files from the Windows image, which could also be damaged. In this situation, you can use DISM to repair the Windows image and then reuse SFC to fix the corrupted files.

In this guide we will introduce step by step instructions on using DISM to return a stable and operational state of the system.

Warning: Before starting to work with the DISM utility, it is recommended to make a complete backup copy system or create a system restore point. In case something goes wrong, you can return the initial state systems.

How to work with DISM commands in Windows 10

When working with DISM, there are three main options for restoring a Windows image: and RestoreHealh. It is important to use them in this order.

Using the CheckHealth option in DISM

The DISM command allows you to detect image corruption. This command It is used only to find damage, but does not perform problem-fixing operations.

Command line because running DISM requires device administrator rights.

DISM /Online /Cleanup-Image /CheckHealth

Using the ScanHealth option in DISM

The command in DISM allows you to scan the Windows image for any damage. Unlike /CheckHealth, the /ScanHealth check can take up to 10 minutes.

To run this command follow these steps:

1. Search for Start menu Command line, press right click click on the link that appears and select Run as administrator.

2. At the Command Prompt, type the following command and press Enter:

DISM /Online /Cleanup-Image /ScanHealth

Using the RestoreHealth option in DISM

The command in DISM allows you to automatically carry out the procedure for restoring damaged Windows images. Unlike /ScanHealth, the /RestoreHealth scan can take up to 10 minutes.

To run this command follow these steps:

1. Search for Start menu Command line, right-click on the link that appears and select Run as administrator.

2. At the Command Prompt, type the following command and press Enter:

DISM /Online /Cleanup-Image /RestoreHealth

Note: When running /RestoreHealth or /ScanHealth, you may notice the procedure hangs between 20% and 40% - this is completely normal behavior.

When you run the /RestoreHealth command, DISM will try to use Windows Update to replace the damaged files. However, if the problem has spread to Windows Update components, then you need to specify an alternative source of working versions of the files to restore the image.

You can specify a new location for working versions of files using the operator /Source next to /RestoreHealth.

Before you can use the repair commands, you need to prepare a copy of the install.wim file from another computer, installation media Windows 10, or file Windows ISO 10. It is also very important that the source of the working versions of the files corresponds to the same version, edition and language of the operating system that is used on the computer.

You can download Windows 10 ISO image with instructions below:

Note: Don’t forget to replace “repairSource” with the path to the source of the working versions of the files. For example: E:\Sources\install.wim .

Now you can run the command to repair the Windows image:

1. Search for Start menu Command line, right-click on the link that appears and select Run as administrator.

2. At the Command Prompt, type the following command and press Enter:

DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim

DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim /LimitAccess

DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:repairSource\install.wim:1 /LimitAccess

The command will run a Windows image recovery using the working versions of the files included in the install.wim file from the Windows 10 installation media. It will not use Windows Update as a source for downloading the required recovery files.

Additionally, not only can you provide a path pointing to install.wim, but you can also use the file install.esd, which is an encrypted version of the Windows image.

If you upgraded to Windows 10 from previous version operating system, the installation files may still be stored on the C drive: this means that you may have a source of working files.

To use the install.esd file to restore a Windows image to your computer, follow these steps:

1. Search for Start menu Command line, right-click on the link that appears and select Run as administrator.

2. At the Command Prompt, type the following command and press Enter:

You can use the following command to limit usage Windows services Update:

Alternatively, you can use the following command to perform the same task:

If the install.esd file is located on a different drive, use the following command:

DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\Install.esd

Note: Don't forget to replace “repairSource” with the path to the source of repaired versions of the files. For example: E:\Sources\install.esd .

The Deployment Image Servicing and Management utility always creates a log file at %windir%/Logs/CBS/CBS.log that contains all fixed and detected issues.

How to fix problems with Windows 10

The instructions described above apply only to restoring a system image. To fix problems in Windows, use the SFC System File Checker.

1. Search for Start menu Command line, right-click on the link that appears and select Run as administrator because device administrator rights are required to run SFC.

2. At the Command Prompt, type the following command and press Enter:

Sfc /scannow

Note: It may take up to three SFC runs to resolve the issue.

The SFC utility will scan and repair damaged system files in Windows 10. To learn more about the capabilities of the tool, read the instructions.

Found a typo? Highlight and press Ctrl + Enter

When working on operating system Windows 10, and any other, anything can happen. For example, while working you notice terrible brakes. The idea arises that a virus or viruses have worked. When checking with an antivirus, there is a possibility of finding viruses, and when you clean them, it is not a fact that any changes will occur, since they managed to screw up.

So, to check Windows files for integrity, you can run the utility sfc /scannow from the command line and if a message appears that "Windows Resource Protection has detected corrupted files but is unable to repair some of them", then this article will help you get rid of this error. If you have Internet access, you can use the article:.

When you scan the system for the integrity of components, when damaged files are detected, they are replaced with working ones from . This folder may have been deleted or the files in it are damaged, then you will see a message that “Resource protection software has detected corrupted files...”.

How to repair a damaged component store using Power Shell

Read where I restored the component store using the following command:

DISM /Online /Cleanup-Image /RestoreHealth

For it to work, you must be connected to the network, since the command contacts the update center and downloads the necessary files from there. It’s possible that this command won’t help either, then let’s use a tool with more capabilities – .

Click on the search icon on the taskbar, and then enter the phrase "PowerShell", from the results select the item "Windows PowerShell", right-click on it and click on option "Run as administrator".

In the window that opens, enter the following command:

Repair-WindowsImage -Online -RestoreHealth


For everything to work you will also need the Internet. You need to wait a little while the files are downloaded, after which the component store will be in a working state and the system will not give you errors.

If everything went well, then in the results you should notice the line:

ImageHealth State: Healthy


It means everything has been restored.

What to do if there is no Internet to restore the component storage?

In this case you will need boot disk, or a flash drive with Windows 10. Almost any image will do, preferably a dozen. Can be downloaded from the Microsoft website.

After downloading the image, double-click on it, thus creating a virtual disk drive. Look at his letter in the explorer, for example, maybe F.

Go back to PowerShell and enter the following command:

Dism /Get-WimInfo /WimFile:R:\sources\install.wim , Where R: letter of the drive created in the image, with installation Windows files 10. This command will determine what kind of system image is in the virtual drive.


Repair-WindowsImage -Online -RestoreHealth -Source R:\sources\install.wim:1

Letter R- this is our drive, and the number 1 – index of the image from the first command.

After recovery, try running the system file integrity check again - sfc /scannow, most likely you will see a message that everything damaged was successfully restored.