title: Changing Registry Folder Permissions throws Access denied
body: <p>I try to change some Reg-Permissions using the following code:</p>
  
  <pre class="lang-psh prettyprint-override"><code>$acl = Get-Acl HKLM:\SYSTEM\CurrentControlSet\Services\TrustedInstaller
  $inheritance = [System.Security.AccessControl.InheritanceFlags]"None"
  $propagation = [System.Security.AccessControl.PropagationFlags]"None"
  $Rule = New-Object System.Security.AccessControl.RegistryAccessRule ("Administrators","FullControl","ContainerInherit","none","Allow")
  $acl.AddAccessRule($Rule)
  $acl | Set-Acl 
  </code></pre>
  
  <p>When I run this I receive the error</p>
  
  <pre class="lang-none prettyprint-override"><code>set-acl : Der angeforderte Registrierungszugriff ist unzulässig.
  In C:\perm.ps1:6 Zeichen:8
  + $acl | set-acl
  +        ~~~~~~~
      + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...rustedInstaller:String) [Set-Acl], SecurityException
      + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.SetAclCommand
  </code></pre>
  
  <p>When I change the permission to full access in the Registry by hand I do NOT receive an error. I run the Powershell-Script under the same user as regedit where modifying permissions succeeded. (using Powershell ISE)</p>