0
我試圖設置註冊表權限到FullControl,但不斷收到此錯誤。一切正常,直到Set-Acl。我究竟做錯了什麼?設置註冊表權限錯誤「Set-Acl:請求的註冊表訪問不被允許。」
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
$acl = Get-Acl HKCR:\CLSID\"{000C1090-0000-0000-C000-000000000046}"\InprocServer32
$newOwner = [System.Security.Principal.NTAccount]"$env:userdomain\$env:username"
$acl.SetOwner($newOwner)
$person = [System.Security.Principal.NTAccount]"Administrators"
$access = [System.Security.AccessControl.RegistryRights]"FullControl"
$inheritance = [System.Security.AccessControl.InheritanceFlags]"None"
$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.SetAccessRule($rule)
$acl | Set-Acl