Ahh sorry - I read your original message as implying it was locked and couldn't be deleted normally as it was loaded - my bad.
Another couple of thoughts: 1. HKCR seems to be actually linked to another key in HK LM or HK CU perhaps deleting it there instead? 2. perhaps interop dll to do it? for instance - RegOpenKeyEx - RegDeleteKey - RegEnumKeyEx ( https://docs.microsoft.com/en-us/windows/win32/sysinfo/deleting-a-key-with-subkeys ) regards, Preet, in Auckland NZ On Fri, 22 Apr 2022 at 13:55, Greg Keogh <gfke...@gmail.com> wrote: > OZ calling NZ. From the command prompt I can delete the key: > > > reg delete HKCR\MyKeyToDelete > > I need the C# code equivalent of this. I'll bet there's a trick for this > hidden somewhere in plain sight?! It doesn't seem dangerous or obscure > enough for special procedures like mounting hives. > > *Greg* > > On Fri, 22 Apr 2022 at 11:29, Preet Sangha <preetsan...@gmail.com> wrote: > >> I kind of get the feeling that this is something that would be done by >> mounting the hive in another instance of windows or perhaps a live Linux, >> or during the set. I cant see how you'd do it programmatically I'm afraid >> (unless your program is a low level on running in the pre-boot stage - like >> when you set up a new os). >> >> I did find this - but it's old and may not be very useful: >> https://www.raymond.cc/blog/how-to-edit-windows-registry-key-values-without-booting-in-windows/ >> >> >> regards, >> Preet, in Auckland NZ >> >>>