How to undelete a Registry key

How to undelete a Registry key
Yaru looks and works a lot like REGEDIT - only it displays deleted Registry keys as well

Editing the Registry can be a dangerous business. Not only are you playing around with some of the most important settings on your PC, but there's no easy way to reverse whatever changes you might make.

And so if you delete something accidentally, then you could be in serious trouble.

It doesn't have to be that way, though. Deleting a Registry key is a little like deleting a file; you may not be able to see it any more, but its data is still there on your hard drive.

And so, if you equip yourself with the right program, and act quickly, then you may be able to recover the lost Registry key (or keys) and get your PC back in working order.

One of the best tools for Registry recovery is yaru (Yet Another Registry Utility). Grab yourself a copy, unzip the download file and run yaru.exe to begin. (Windows Vista and 7 users should run it as an administrator; right-click yaru.exe and select "Run as Administrator".)

You won't see any Registry values immediately because yaru works offline, and you'll need to open the relevant hive file first. To open HKEY_CURRENT_USER, say, click File > Open User Hive (local) and choose your user account; to open HKEY_LOCAL_MACHINE\Software click File > Open Software (Local); to open HKEY_LOCAL_MACHINE\System click File > Open System (local), and so on.

The tree for your chosen section of the Registry should now appear, and at the bottom of this will be a branch called Deleted Keys. Open this, browse through what's on offer, and with any luck you'll find your deleted settings.

There are no guarantees, though. If you don't act quickly after deleting a setting then there's a chance it may be overwritten by some other value, and that's what has probably happened here. Confirm that you really are looking in the right area of the Registry, and if so then you'll need to look at some other possibility for recovery.

System Restore will restore your entire Registry back to a previous version, for instance, and if you've a full system backup then that may also help.

Export and restore

If yaru managed to find your lost settings, though, then you'll need to export these in a format which can re-imported into your current Registry. And that only takes a moment. Just right-click the top-level lost key and choose the appropriate export option, which will probably be "Export keys to file [Recursive]"; this means export everything beneath this level to a Registry file. And save the results to a file called "recover.reg" (or something similar) on your desktop.

With that done, now find and double-click the file you've just saved. Windows will warn you that setting a block of Registry keys in this way can be dangerous. If you're 100% sure that you want to do it, though, click "Yes", they'll be imported, and that's it - your lost Registry settings have all been recovered.

You do need to be careful with this technique. You shouldn't assume it gives you leeway to freely delete whatever Registry settings you like, for instance - there's no guarantee yaru will be able to recover any particular value.

And you also have to be careful in deciding what to restore. If you make a mistake there, restore the wrong Registry keys by accident, then you could make your situation even worse. If you're at all unclear about any of these steps then make sure you get yourself some insurance by running System Restore and making regular system backups.

For the most part, though, yaru is an easy way to restore lost Registry keys. Powerful yet compact (the executable file is only 1.4MB), it's packed with powerful features, and is well worth a place in your portable troubleshooting toolkit.

Mike Williams
Lead security reviewer

Mike is a lead security reviewer at Future, where he stress-tests VPNs, antivirus and more to find out which services are sure to keep you safe, and which are best avoided. Mike began his career as a lead software developer in the engineering world, where his creations were used by big-name companies from Rolls Royce to British Nuclear Fuels and British Aerospace. The early PC viruses caught Mike's attention, and he developed an interest in analyzing malware, and learning the low-level technical details of how Windows and network security work under the hood.