0

I'm trying to modify the permissions of a registry key, however before I can do that I need to change the owner of that key.

Is it possible to do that using a powershell script? I've seen that you can modify the permissions of any group using RegistryAccessRules but I couldn't find any info about changing the owner of that key.

Any help would be much appreciated!

3
  • 1
    Does How do I take ownership of a registry key via PowerShell? - Stack Overflow answer your question?
    – DavidPostill
    Commented Dec 7, 2022 at 18:55
  • @DavidPostill Not really, after using the enable-privilege function: enable-privilege(SeTakeOwnershipPrivilege) and trying to set $key to this value: $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Microsoft\WindowsRuntime\AllowedCOMCLSIDs\",[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::takeownership) I get "access to the registry key is denied" error so can't really follow with the rest of the script. What am I missing here? Commented Dec 7, 2022 at 20:07
  • admin elevate the shell then run the logic and see what happens. Also, see my answer on this post if there is a multistring, you have to rebuild it with array: stackoverflow.com/questions/33009154/create-symlink-with-gpo/… Commented Dec 7, 2022 at 20:13

0

You must log in to answer this question.