Mirror ACL

$acl must be changed to be applicable. Get the ACL from hkcu:\software\foo, take its access rules as NTAccount, remove and re-add the first rule, then apply the ACL to hkcu:\software\bar.

$acl = get-acl -path hkcu:\software\foo
$r = $acl.GetAccessRules( $true, $true, [security.principal.ntaccount] )
$acl.RemoveAccessRuleAll( $r[0] )
$acl.AddAccessRule( $r[0] )
set-acl -path hkcu:\software\bar -aclobject $acl
Updated: 2026 Aug 19