Solved Delete protected sub registry key with batch file

Microsoft Office professional 2010 softw...
June 5, 2014 at 19:20:35
Specs: Windows 8, 4G
Hi

Trying to delete the following registry key with a batch file but I can't even delete in the registry editor. Any ideas on how to write a batch file to do it, maybe it need to change permission also.

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\PRINTENUM\

There are about 8 sub keys under PRINTENUM such as {1974F44D-A278-......} that I want to be deleted.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\SWD\PRINTENUM

Same as above.


Thank you in advance if anyone can help me with a script.


See More: Delete protected sub registry key with batch file

Report •


#1
June 6, 2014 at 12:10:17

You should normally be able to remove PRINTENUM (if that's what you mean) with a reg file, like this (export it first):
[-HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\PRINTENUM]

It can be restored without the sub-keys like this:
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\PRINTENUM]

Always pop back and let us know the outcome - thanks


Report •

#2
June 6, 2014 at 17:20:27
I didn't remove the whole printenum key but I did have a .reg file to delete those sub keys but didn't work and I have also tried doing it in the registry editor but won't let me delete any of them for some reason. Any other solution ?

Report •

#3
June 6, 2014 at 17:32:10
✔ Best Answer
For individuals it is:
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\PRINTENUM]
"first one"=-
"second one"=-

...and so on for each sub-key. The path to PRINTENUM remains in place.

EDIT:
See also this:
http://www.windowsnetworking.com/kb...

Always pop back and let us know the outcome - thanks

message edited by Derek


Report •

Related Solutions

#4
June 6, 2014 at 18:33:42
As I mentioned before it will not remove , it seem to be protected by the system.

Report •

#5
June 6, 2014 at 20:10:05
I'm on shakey ground here, but maybe the registry is maintaining "self-consistancy" with another area. F/e, possibly HKCurrentConfig under "system", or the same set of sub-keys as HKLM, and you have to remove these others first. If a key that you are trying to delete appears more than once in the registry, then maybe that is the case. Windows Registry anatomy is very much NOT my specialty, and infinitely less so with windows 7 or 8.

Report •

#6
June 6, 2014 at 20:35:05
Yes it's in the same places as I mentioned in the first post. It's also in devices manager if I showed hidden devices under printers and it will be greyed out but I can delete it from there also. Just wanted a script to do it. Couldn't delete any of it under registry edit.


Report •

#7
June 7, 2014 at 08:18:39
Probably protected. Did you try Psexec in my added link at #3?

Always pop back and let us know the outcome - thanks


Report •

#8
June 7, 2014 at 08:40:28
Further to my #3. I think you are barking up the wrong tree looking for a script. A reg file is the normal way but I believe the entries are protected (locked). A script will hit the same issue. Here is some more information based on a 2010 XP post of mine:

=====================================
Download PsTools from here (new link):
http://technet.microsoft.com/en-us/...

The file you want (inside zip) is 'psexec.exe'

For convenience I put mine in a sub-folder 'C:\Program Files\PsExec'.
I started it with a shortcut (named Regedit Unrestricted) using this as its target:
"C:\Program Files\PsExec\psexec.exe" -i -d -s c:\windows\regedit.exe

=====================================

This worked for me in XP. In Windows 8 (just checked) you must run the batch file shortcut as Administrator - right click it and go to Compatibility tab if you want this permanent.

Take care with what you are deleting.

Always pop back and let us know the outcome - thanks

message edited by Derek


Report •

#9
June 7, 2014 at 10:51:31
Note that I have edited the above post (simplified) so please re-read it if you have seen it already.

Always pop back and let us know the outcome - thanks


Report •

#10
June 9, 2014 at 13:52:52
Do you have problems deleting the key if you elevate through UAC?

How To Ask Questions The Smart Way


Report •

#11
June 9, 2014 at 14:19:27
kiwi_hk

Any progress on this or are you still struggling? I managed to delete some locked keys by using Psexec in the past.

Always pop back and let us know the outcome - thanks


Report •

#12
June 9, 2014 at 20:52:35
Thanks Derek, I did try psexec -s --i on the server and having the .reg file on the server too, but just couldn't run it on the client with admin command prompt using \\server\..... tried all sorts of reg import, to running the reg file with -aaceptuela given me error 0 which should be no errors and error 1 which I tried to login using -u to run it or runas etc.,.,

At the end I had to copy the .reg file and psexec to the local hard drive with the script and ran D:\PsExec.exe -i -s -accepteula reg import "D:\hidden_printers.reg" for ir to work.

Thanks again.



Report •

#13
June 10, 2014 at 04:21:50
OK, thanks for feedback.

Always pop back and let us know the outcome - thanks


Report •


Ask Question