Backup and restore the registry
Protect a key before a change, back up whole hives, use restore points and System State backups, and recover an unbootable machine.
Pick the right level
| Scope | Backup | Restore |
|---|---|---|
| One key before a change | reg export or Regedit File > Export | Import the .reg file (adds and overwrites only) |
| One branch, exactly | reg save (binary, includes permissions) | reg restore (replaces the branch) |
| Whole client machine | System Restore point (Checkpoint-Computer) | System Restore, from Windows or Windows RE |
| Whole server | Windows Server Backup System State (wbadmin start systemstatebackup) or your backup product | System State restore (Directory Services Restore Mode for domain controllers) |
Before every change
$stamp = Get-Date -Format yyyyMMdd-HHmm
reg export "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL" "C:\RegBackup\schannel-$stamp.reg" /y
reg save "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL" "C:\RegBackup\schannel-$stamp.hiv" /y
To roll back a .reg-tracked change cleanly, delete the key first and then import the export, because an import doesn't remove values that you added afterwards.
Restore points on Windows 11
Enable-ComputerRestore -Drive 'C:\'
Checkpoint-Computer -Description 'Before registry change' -RestorePointType MODIFY_SETTINGS
Windows creates at most one restore point every 24 hours through Checkpoint-Computer by default. System Restore isn't available on Windows Server.
The RegBack folder
Older Windows versions copied the machine hives to %SystemRoot%\System32\config\RegBack automatically. Since Windows 10 version 1803 this periodic copy is turned off by default to save disk space, so the folder exists but its files are empty. Microsoft documents how to turn it back on (the EnablePeriodicBackup value under HKLM\System\CurrentControlSet\Control\Session Manager\Configuration Manager) and recommends System Restore or a real backup instead.
Recover a machine that won't boot
- Boot Windows RE (Advanced startup or installation media) and try System Restore first.
- From the Command Prompt in Windows RE,
reg loadthe offline SYSTEM or SOFTWARE hive (see the offline hives lesson) and undo the specific change, for example set a broken driver'sStartvalue to 4. - If a hive file is damaged, restore it from your System State or image backup.
References: The system registry is no longer backed up to the RegBack folder, reg save, reg restore, wbadmin start systemstatebackup.