How to backup and restore the Registry

How to backup and restore the Registry

Editing the Windows registry is one of those tasks where you absolutely want a working safety net before you start. Whether you’re testing a new Intune-deployed remediation script, debugging a legacy app, or rolling back a vendor-installed mess, a clean registry backup and restore workflow turns “this might wreck the device” into “I have a 30-second undo button”. This post walks through the approach I use on every test device and ship as part of any Intune remediation that touches HKLM/HKCU — including a PowerShell-based snapshot that captures specific keys, ships the export to OneDrive, and verifies the restore worked.

When I try something out or develop something new I don’t always do this in a VM, I use directly my productive system (I wouldn’t recommend it but I do it anyway). But changes in the registry can bring the PC into such a state that you have to set it up again. To avoid this, in this blog I look at a way to create a backup of the registry that can be restored at a later date.

What is the Windows Registry

The Windows Registry (RegEdit) is a storage that stores settings for the Windows OS as well as for apps. The Registry is a hierarchical database. The registry holds configuration used by services, kernel, device drivers, and others.

How to backup and restore the Registry
Source: Wikipedia

Create a backup

  • Open the Registry Editor via Start menu or Run and insert regedit
How to backup and restore the Registry How to backup and restore the Registry
  • Click File -> Export
How to backup and restore the Registry
  • Enter a file name and click Save to back up the registry in the selected location.
How to backup and restore the Registry

Restore from a backup

  • Open the Registry Editor via Start menu or Run and insert regedit
How to backup and restore the Registry  How to backup and restore the Registry
  • Click File -> Import
How to backup and restore the Registry
  • Select the Backup and click Open
How to backup and restore the Registry
  • Wait until the Import is done
How to backup and restore the Registry

When you get this message, click OK, open RegEdit as Admin, and make sure that all applications are closed. Start a new import attempt.

How to backup and restore the Registry
  • When the import was successful, restart the device.

Conclusion

Especially when you want to try something on a system, it is sometimes good to have a backup of the registry to jump back to the previous state. It is really easy and fast to create such a backup and restore it.

Stay healthy, Cheers
Jannik