Is it possible to import a Windows registry file without destroying a system?

3

Let me just check one thing first. Doing an export through Regedit (range: all) is the equivalent of making a backup of the Windows registry, right?

So I saved the Reg file to disk drive L yesterday. Now I would like to go back to using that old version of the registry, in order to revert any changes made to the registry. And this is done through the import option in Regedit, right?

Does importing a Reg file through Regedit mean merging the information from the Reg file to what's already there, or does it overwrite everything with what's being imported? I know that opening small single Reg files with registry fixes prompts whether or not to merge it with the registry. But how about the Reg files generated through the export option of Regedit?

Anyhow... so I started Regedit and then went to File, Import, selected my Reg file, and then clicked Open. It took some time to import, I mean the file is like 480 MB or something. But then I got an error message saying something along the lines "not all keys were imported" or similar because it was "in use by the system" or similar. So for that reason it couldn't import everything.

So I decided to reboot into safe mode with command line support. Now this is what I got.

L:\>reg import "regbackup 2013-06-14.reg"
ERROR: Error accessing the registry.

L:\>

Error accessing the registry? That doesn't tell me anything! What's the error code? What is the cause?...

Now if I look at the task bar I can see an x over the speaker. And if I hover the cursor over it I see it says "the audio service is not running."

audio service

Now is this caused by a failed registry import operation or by the fact that I started Windows in safe mode? I'm thinking it should not be persistent... so what if I started in safe mode?... am I not allowed to do that? I know audio is disabled in safe mode, but I'm not in safe mode now. I'm back in normal Windows mode now so the service should be really working now. So this got me thinking that the failed import might have just screwed up the registry somehow.

Long story short: What's causing this error and the audio service to stop? And how do I import to registry what has been exported from it once?

Update

Alright, I took the time to try import the file through Regedit again while in normal Windows mode. So here is the error message I mentioned above.

importing registry

registry error

It reads:

Cannot import L:\regbackup 2013-06-14.reg: Not all data was successfully written to the registry. Some keys are open by the system or other processes.

And what's the natural thing to do if something is being used by a system or some process? You have to close it and try again, right? But how do you close a system and prevent it from using some files while you are performing maintenance or troubleshooting on? Right! You enter safe mode! In safe mode only the bare minimum of drivers and services and processes and whatever, is loaded. I even used the non-graphical safe mode (command line). And when all this fails, then what?...

Update 2

This is just getting better and better... or not!

The audio service is called Winodws Audio. It depends on Windows Audio Endpoint Builder, and RPC (Remote Procedure Call). RPC is already started and working, but I can't make Audio Endpoint start. So I can't start Windows Audio either. So in layman's terms I don't have sound on my computer now after trying to import the registry file. Nice!...

I was getting desperate so I decided to try the regular safe mode with GUI just to make sure I've tried all of them. I started Regedit and tried importing the registry file. I got the same kind of error messages as the one I got when I used the Reg command in cmd (see code block above). I just saw the progress bar and it was importing, and at the end it spits out the error.

error in safe mode

Note that the error received in Regedit in safe mode is different from the one received in normal Windows mode.

It was after running safe mode with command line and using Reg command to import registry file that the Windows audio service stopped working. If I try to run the audio service, or the audio endpoint builder, either in safe mode or in normal Windows mode, all I get is errors.

services error 1 - safe mode

services error 2 - safe mode

Well obviously the audio endpoint builder can't start in safe mode. But it can't start in normal mode either, and this is concerning now.

services error 1 - normal mode

services error 2 - normal mode

So the error I get is:

Error 0x80070003: The system cannot find the path specified.

All this caused by importing the registry file? I can't believe it!

I don't have any system restore point. Any suggestions?

Update 3

What's the "search path" is the error message above talking about?... to the audio DLL??

I tried removing the dependency for Windows Audio Endpoint Builder in registry. That way I assumed that I will be able to start Windows Audio service without it. I changed following values.

Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AudioSrv
Value: DependOnService

Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AudioEndpointBuilder
Value: DependOnService

I rebooted but it was to no avail. Now I get the message No Audio Output Device is installed in task bar.

Oh yeah, I also checked C:\Windows\System32\ and I have the audiosrv.dll file in place.

I tried re-installing the audio driver and software as suggested on some Microsoft websites but that was to no avail either. I still have the same message in task bar when I hover over the speaker icon.

The next step will be to take a file/folder backup and re-install Windows. Unless someone comes along with a suggestion that will solve the issue.

By the way, Windows RE (recover environment) didn't help because there is no issue with starting up Windows. It's mainly used for repairing start-up issues.

Also, running sfc /scannow produces following.

C:\Windows\system32>sfc /scannow

Beginning system scan.  This process will take some time.


There is a system repair pending which requires reboot to complete.  Restart
Windows and run sfc again.

C:\Windows\system32>

I tried normal mode, safe mode, console mode, nothing... same message. I suspect that this command became an issue after running the psexec -i -d -s %windir%\regedit.exe command and then trying to import the Reg file as system account, as suggested by STTR.

windows-vista
windows-registry
services
asked on Super User Jun 15, 2013 by Samir • edited Jun 15, 2013 by Samir

2 Answers

6

Let me just get one thing out straight away, importing a huge registry file like you did is a bad idea.

When you export keys to a .reg file, you're simply creating a file that will contain instructions on how to re-create the keys you selected. Note that it will only take care of creating keys. Thus, when you later import the file, a merge will happen. Keys that don't exist in the registry any more will be re-created (which might be a horrible thing to happen) and keys that have changed will have their value overwritten (which might be just as horrible). Keys that were created from later boots of Windows will still exist after importing the .reg file.

A .reg file can even contain instructions to remove keys from the registry completely (although that won't be the case when exporting from the Registry Editor). So it is advisable to know exactly what a .reg file contains and what it will do. With a 480 MB file, it's very unlikely that you'll be able to know what will happen when you parse it.

At this point, I have serious doubts if you will be able to recover from this and get everything back to a proper working state. Luckily, the result of this doesn't seem too catastrophic. Good luck! If you have shadow copies enabled, the guide How to Restore Previous Versions of the Registry in Windows 7 might help.

I know that there are several guides online (like the one on the Windows website) that treat the .reg file export as a backup of the registry and, to some extent, it is. It represents a certain state of the registry at some point, but merging that state with a later state isn't really advisable (as you've just found out).

However, if I wanted to make a proper backup of the registry, I would copy the registry files from C:\Windows\System32\Config. Those could simply be replaced later to fully replace the state of the registry.

answered on Super User Jun 15, 2013 by Der Hochstapler
0

Windows Sysinternals PsExec v1.98

psexec -i -d -s %windir%\regedit.exe

May use DaRT CD or WinPE and mount and edit registry.

I have to say has never tried to do a full import. The image of the operating system or virtual machine is much better.

Password reset programs only find passwords from one OS on a dual-boot system

answered on Super User Jun 15, 2013 by STTR • edited Mar 20, 2017 by Community

User contributions licensed under CC BY-SA 3.0