Practice "Safe Computer" with regular
automated Registry Backups

by Peter A. Bromberg, Ph.D.

Peter Bromberg
"There are no mistakes, save one: the failure to learn from a mistake. " --Robert Fripp

I've had plenty of experience (as have, I am sure, many others) with corrupted registries and learning how to recover all your "stuff". And the subtext of one of the tenets of Murphy's Laws says that "the longer you go without a corrupted registry, the greater your chances become of experiencing one".

You did What?

In case you haven't experienced this wondrous disaster, a Windows OS with a corrupted registry usually will not boot. If it won't boot, that means you can't fix it. And if its a server that's in production, and you don't know how to recover the machine and everything that's on it, your ass is toast, pal. Don't think it will happen to you? Think again! There are a hundred things that can happen that will corrupt the Registry, not limited to commercial software that doesn't uninstall properly, or power glitches. If it hasn't happened to you yet, plain old statistical probability is already working against you at this point (as explained by Murphy above). Even in those cases where a machine will still boot up the OS, a corrupted Registry can result in a machine that is, essentially, useless.

Usually when your Registry is corrupt, you can still boot into Safe mode, and if you've been smart enough to create a Recovery disk, you can use that to go into a DOS-like environment, and if you know how, you can fix things. However, if you don't have a recent backup of the Registry, none of this will do you any good. Let me just rephrase that so it is sure to sink in:

If your Registry becomes corrupted, and you do not have a recent backup and know how to restore it, you are SUNK.

Okay? You may not agree, but for now, just humor me and accept this as the Gospel.

You're "almost" sunk!

Well, you're "almost" sunk. One thing you can do is grab your Windows CD, boot off of it, and go through the entire setup routine as if you are installing Windows for the first time. At the very last part, the setup will identify any previous Windows installations and you'll be prompted with the option to (R)epair that installation. What this does is leave all your Software etc. registry hives alone, but restore the other parts of the Registry and completely re-install the OS. All your software, shortcuts, and whatever else should remain intact. However, if you are practicing "Safe Computer" you should NEVER have to get to this point. At the least, you will probably agree that it is nerve-wracking, and not fun at all.

Please don't lecture me on System Restore. That's only for Windows XP, and I don't like it. In fact, I keep the service disabled to conserve resources.

Protect Your Butt!

Now, let's talk about an easy, automated way to ensure that this never happens. It's so simple that anybody reading this short article who doesn't do it (or something similar) has got to be a complete idiot, and deserves whatever happens to them!

First: Download and install a copy of Lars Hederer's ERUNT utility. This is a very reliable Registry backup utility that has some nice command line options and also an "AUTOBACK.EXE" companion executable that can be used to schedule automated Registry backups as well as automatically delete backups that are older than a set number of days.

Second: Make yourself a backup batch file:

C:\ERUNT\AUTOBACK.EXE %SystemRoot%\ERDNT\#Date# /noconfirmdelete /days:7

-- put the above in Notepad, and save it right in the ERUNT folder as "RegistryBackup.bat".

Third: In Control Panel, open up "Scheduled Tasks" and choose "Add Scheduled Task". In the Scheduled Task Wizard, click NEXT and then BROWSE to your newly saved batch file. Then choose the frequency (I use Daily). Pick a time to perform the backup, fill in your username and password, and complete the Wizard.

What this will do is backup your registry into the Windows\ERDNT folder with a subfolder named for today's date, and delete any subfolders older than 7 days automatically.

Fourth: RTFM! Lars' Readme.txt file has a number of techniques and additional information to help you, including a couple of "disaster scenarios" that tell you what you can do to recover. If I had a dollar for every time I see somebody install software without taking the time to Read The Friggin' Manual, I'd be a very rich man!

If you ever need to recover your Registry, navigate to the backup subfolder you want to recover from, if necessary from Safe Mode or a Recovery Console prompt, and execute the "ERDNT.EXE" executable that ERUNT has stored there with your Registry files. ERDNT.EXE will automatically restore your Registry and you can reboot.

N.B. (4/29/2006): The latest version of ERUNT supports all 64-bit versions of the Windows OS.

If you don't have an existing Registry Disaster Recovery solution in place, please do this NOW. You will thank me later.

Peter Bromberg is a C# MVP, MCP, and .NET consultant who has worked in the banking and financial industry for 20 years. He has architected and developed web - based corporate distributed application solutions since 1995, and focuses exclusively on the .NET Platform.
Article Discussion: