The Windows registry is an important part of the operating system, which stores important system, user, and program settings. Due to incorrect changes in the system registry made by programs or users, you may encounter various problems — up to the complete inability to boot Windows. In this article, we’ll go over the basic ways to fix and restore a corrupted registry on Windows 10.
By default, Windows registry files are stored in the directory C:\Windows\System32\config.
Below is a list of files and registry hives that these files are loaded into when Windows boots (as you see them in Registry Editor):
- DEFAULT (HKEY_USERS\DEFAULT) — a template with user settings used when creating new accounts;
- SAM (HKLM\SAM) — the settings of all Windows security principals are stored;
- SOFTWARE (HKLM\Software) — the settings of various applications and the Windows OS itself are stored, common to all users;
- SECURITY (HKLM\Security) — Windows security settings;
- SYSTEM (HKLM\System) — settings for computer’s hardware, settings for Windows services, drivers, and other low-level information;
- In addition, the registry files NTUSER.DAT and USRCLASS.DAT are stored in the profile of each user (C:\Users), which contains the user settings (loaded to the HKEY_CURRENT_USER registry hive).
If your Windows does not boot correctly due to the damaged registry, you need to check the integrity of the registry files. In earlier versions of Windows, the Windows Registry Checker tool (Scanreg.exe) was available to automatically back up the registry, and check the registry for invalid entries, empty data blocks, and other errors. However, starting with Windows 7, Microsoft stopped supporting the Scanreg.exe tool. It is recommended to use the Dism.exe and Sfc.exe command-line tools to check the integrity of system files (including registry files), and fix the errors.
Open a command prompt as an administrator and run the command:
If the utility finds a damaged system file, it will try to repair it.
If the SFC utility found errors and couldn’t perform a repair (Windows Resource Protection found corrupt files but was unable to fix some of them), you need to check and repair the component store using the DISM command:
DISM /Online /Cleanup-Image /RestoreHealth
If these commands did not fix your problem, you need to restore the registry from the last restore point or registry files backup.
On Windows 10, the registry files are automatically backed up to the C:\Windows\System32\config\RegBack folder. For such a registry backup to work in Windows 10 1803,1809,1903,1909,2004 and newer Windows 10 builds, you need to manually turn on automatic registry backup through the special reg parameter (this must be done beforehand before problems with the registry appear).
Hint. Microsoft dropped the automatic registry backup procedure to shrink Windows 10 size. Microsoft recommends using a system restore point to repair a corrupted registry.
- Run Registry Editor (regedit.exe);
- Go to the registry branch HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager;
- Create a new DWORD parameter named EnablePeriodicBackup and value 1;
- Restart your computer;
- Now registry files will be backed up to the RegBack folder automatically by the Windows maintenance task.
Hint. You can enable this registry parameter via PowerShell:New-ItemProperty -Path ″HKLM:\System\CurrentControlSet\Control\Session Manager\Configuration Manager″ -Name EnablePeriodicBackup -Type DWORD -Value 1
Now, if your Windows fails to boot due to the corrupted registry files, you can boot your computer into Windows Recovery Environment, open a command prompt, and replace the corrupted registry files with files from the backup using the command:
xcopy c:\Windows\System32\config\regback c:\Windows\System32\config
Then restart your computer normally.