3

I have come across some registry edits/hacks I'd like to make. however, it appears that you have to take control of some registry keys before you can make the edit. In the articles, this is a manual process, though VG does go into some other options.

However, I'd like to be able to run 1 .reg file to accomplish 1 task, including taking ownership of the registry key I am trying to modify or add. Is that possible?

If that's not possible, then how likely is it that I can drop out to Power Shell to perform the take ownership and registry key? I know Power Shell can do the latter, but I'm not sure about the former. In this case, have 1 script file is my goal, even if it isn't a .reg script, but a Power Shell one.

7
  • I linked to that in the OP. Those options are not related to a registry file; they are command line programs that won't work in a registry file. Some of the programs have to be downloaded. Commented Jun 24, 2017 at 14:23
  • 1
    You can't change registry permissions using a .reg file, but you can change the registry using a .bat file. So the entire thing can be scripted in a .bat file, thats what @DavidPostill means by referring to that link.
    – LPChip
    Commented Jun 24, 2017 at 14:25
  • 1
    Exactly what @LPChip said.
    – DavidPostill
    Commented Jun 24, 2017 at 14:41
  • You have to change the permissions first or the reg file will fail.
    – DavidPostill
    Commented Jun 24, 2017 at 14:53

1 Answer 1

1

Powershell doesn't have any built-in cmdlet to do so, but you can use directly the Microsoft.Win32.Registry functions to pull this off.

https://stackoverflow.com/questions/12044432/how-do-i-take-ownership-of-a-registry-key-via-powershell
https://forums.mydigitallife.net/threads/lean-and-mean-snippets-for-power-users-runasti-reg_own-toggledefender-updated-2022-05-22.83479/#post-1658809 (mirror)

You must log in to answer this question.

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