The Resource Kits contain Regback.exe, to backup the registry, and Regrest.exe, to restore it.

If you run Regrest.exe and receive:

Replacing sam with sam.old
Replace failed hivebranch='machine', hive='sam', result='0x000005aa'
newfile='sam.old'
savefile=sam.bak'

then your Registry Size Limit (RSL) is too small to contain two copies of the registry hives that are being restored.

Use Control Panel / System / Performance / Virtual Memory / Change. Increase (double) the Maximum Registry Size (MB) value in the Registry Size section.

NOTE: The decimal equivalent of 5aa is 1450. Typing net helpmsg 1450 returns Insufficient system resources exist to complete the requested service.