fix language specific "Administrators" string by using SID

ref #36
ref #37
This commit is contained in:
Alex Hirsch 2015-08-30 12:16:44 +02:00
parent 27f6ba020c
commit 77bed6ec9d

View File

@ -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