Browse Source

fix language specific "Administrators" string by using SID

ref #36
ref #37
pull/41/head
Alex Hirsch 9 years ago
parent
commit
77bed6ec9d
  1. 7
      lib/take-own.psm1

7
lib/take-own.psm1

@ -15,11 +15,14 @@ function Takeown-Registry($key) {
} }
} }
# get administraor group
$admins = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544")
$admins = $admins.Translate([System.Security.Principal.NTAccount])
# set owner # set owner
$key = $reg.OpenSubKey($key, "ReadWriteSubTree", "TakeOwnership") $key = $reg.OpenSubKey($key, "ReadWriteSubTree", "TakeOwnership")
$owner = [Security.Principal.NTAccount]"Administrators"
$acl = $key.GetAccessControl() $acl = $key.GetAccessControl()
$acl.SetOwner($owner) $acl.SetOwner($admins)
$key.SetAccessControl($acl) $key.SetAccessControl($acl)
# set FullControl # set FullControl

Loading…
Cancel
Save