Also posted this on WinXP, but the more minds the better:
I (as administrator) deleted a former user's account and profile. Now, I can't delete some registry keys-it says "Error deleting key". I suspect these keys in HKLM/software are from programs installed under that user (who also had administrator privileges). I've tracked the problem to Permissions; if I try to take ownership, it shows prior owner as "Unknown", but I can successfully take ownership despite it saying it failed. It then shows a permission belonging to the SID of the former user, which can then be deleted. Then I add permission under my administrator account, and if there are no further subkeys, I can delete the key finally.
The problem is, none of the subkeys appear until I take ownership, and the former user's SID doesn't show up until all this fiddling; so I have to then take ownership of each key one at a time; new deeper subkeys then appear, etc. For some key trees it's not bad; but for some (like an Intuit application's) it's a pain. Trying to have the "take ownership" and "add permission" apply to all children doesn't work (it just says failed, and doesn't do anything).
Safe mode didn't help. I haven't tried recovery console (cause I can't find the xp disk right now), but from a post here it doesn't appear that would work either. I suppose if there were a way to create an owner with the same SID, but that doesn't appear possible. Otherwise? (I've read MS's KB on taking permission...)