A useful script to set registry key permissions with Powershell. This example gives full control to the built in Users group.
$acl = Get-Acl "HKLM:\SOFTWARE\Example"
$person = [System.Security.Principal.NTAccount]"BuiltIn\Users"
$access = [System.Security.AccessControl.RegistryRights]"FullControl"
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"
$propagation = [System.Security.AccessControl.PropagationFlags]"None"
$type = [System.Security.AccessControl.AccessControlType]"Allow"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person,$access,$inheritance,$propagation,$type)
$acl.AddAccessRule($rule)
$acl |Set-Acl