I'm getting

reg save  HKLM  HKLM_save.hiv /Y
ERROR: Access denied

when executing this at an administrator command line (windows 10).
reg export on HKLM works like a charm. (btw, "access denied" does not refer to the output file)

How to solve this error ?

1 Answer 1


Believe it or not, not even administrator has total control of these keys (without taking ownership). Microsoft started putting policies like this in place as of Windows Vista due to all of the malware they were dealing with.

You would need to take ownership of the entire HKLM hive to get a backup of the entire tree. This is something I do not suggest. They did this permission scheme for a reason.

The export command silently fails on keys it can't read (and continues) whereas the backup command does not and spits out an error because it can't backup keys it doesn't have access to.

I myself would take the route of either taking whatever keys can be exported OR backing up the entire volume as the permission relationships are part of a bigger system than just access to registry keys.

I haven't tried it but you could possibly backup the hive itself (as in the file) without using registry functions if that is what you really want. I bet it will work.

  • Why does reg export succeed then? Or does this silently ignore the keys it can't read?
    – MRalwasser
    Oct 24, 2021 at 13:26
  • @Ramhound Nope: "reg export on HKLM works like a charm."
    – MRalwasser
    Oct 24, 2021 at 14:03
  • Answer updated for more specificity. I guess.. what I meant to say in the first place. It was super early in the morning (here) and my brain was not 100% functional. Oct 24, 2021 at 15:29
  • Ah, thanks! Do you have a reference that svn export silently fails/ignores (which I would find strange)?
    – MRalwasser
    Oct 24, 2021 at 15:57
  • No, I don't. I do know how the registry and windows security work from an API point of view and the reason was obvious. If you browse around RegEdit under HKLM long enough, you will find that there are many keys you can't browse without taking ownership of. Clearly, this is the cause of "access denied".. if you aren't getting this error (export) clearly this fact is being ignored. Oct 24, 2021 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .