0

As an example, I'm trying to apply the main answer from How do I change "Open with Powershell" to "Open with Command Prompt" when shift-rightclicking in Explorer?.

I'm the only user of the computer, and administrator. In good Win7 days, I would just open regedit.exe and edit the key.

Now in Win10, even if I start regedit.exe as administrator, it seems I cannot rename HKEY_CLASSES_ROOT\Directory\shell\cmd\HideBasedOnVelocityId without a long process and/or using a third party tool like regownershipex.

I can't imagine doing this each time I want to edit a registry key.

Question: how to, as an admin, bypass the Win10 registry ownership rules, and edit the registry "normally" without having to use a tool like regownershipex?

Even if I should disable some security features, it's fine, but I don't want every registry tweaking to become a long task - I want to keep it simple and stupid like in Windows 7. How to do this?

Basj
  • 1,489
  • 7
  • 47
  • 90
  • Windows 'Administrator' just isn't 'root'. Even 'NT Authority\System' has limits. Windows Resource Protection has been built into every windows since Vista/2008, and what you are seeing is them choosing to configure it more stringently with subsequent versions. you won't be able to just disable it. being able to do so makes it more or less worthless to everyone else since other people need to make sure that attackers can;t do that to their PCs. https://en.wikipedia.org/wiki/Windows_Resource_Protection – Frank Thomas Aug 30 '23 at 21:30

1 Answers1

0

To be able to run regedit or a script as TrustedInstaller and so have full permissions on all registry keys, one could use AdvancedRun that allows running as System or TrustedInstaller.

For more information see the article
How to run Command Prompt as TrustedInstaller on Windows 11.


If you need to take ownership repeatedly of only a few specific keys that are owned by TrustedInstaller, you could create a script to do the task. Or two scripts to change the ownership and later undo it.

One command-line tool that is useful here is SetACL.

The following (untested) commands could do that when Run as Administrator :

SetACL.exe -on "HKEY_CLASSES_ROOT\Directory\shell\cmd" -ot reg -actn setowner -ownr "n:Administrators"
SetACL.exe -on "HKEY_CLASSES_ROOT\Directory\shell\cmd" -ot reg -actn setowner -ownr "n:nt service\trustedinstaller" -rec Yes

These commands were based on information from the article Take Ownership of Registry Key & Assign Permissions Using Command-line. You will find more information in the article itself.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Thanks for your answer. As an administrator, I would like to be able to modify *any key* of the registry, no matter the owner of a key, is that possible? (I tried to put UAC to the lowest setting, but it doesn't work). I would like to keep things simple - edit the registry without having to run command line tools all the time, like I did in Win7. How to do this and disable registry ownership security? – Basj Aug 30 '23 at 20:24
  • 1
    You might be able to run regedit or a script as TrustedInstaller using [AdvancedRun](https://www.nirsoft.net/utils/advanced_run.html). See for example this [writeup](https://pureinfotech.com/run-command-prompt-trustedinstaller-windows-11/). If it works for you, I'll add it to the answer. – harrymc Aug 30 '23 at 20:30
  • Yes @harrymc, this could be interesting, these Nirsoft tools are always excellent! – Basj Aug 31 '23 at 10:24
  • 1
    Why the downvote? @harrymc's solution seems interesting. – Basj Sep 01 '23 at 07:25
  • About your last comment @harrymc, I tried AdvancedRun with TrustedInstaller and it works! You can write it in the answer, I think it's the best/quicker option. – Basj Sep 01 '23 at 08:32
  • (Downvotes on our site are weird.) Thank you for confirming that this method works, so I added it as the main part of my answer. – harrymc Sep 01 '23 at 08:50
  • Please consider marking my answer as accepted. – harrymc Sep 01 '23 at 09:13