title: Powershell ACL setting ACL entry to allow or deny type
body: <p>Ok, so I'm having trouble with figuring out how to change an ACL for a folder using powershell. I have NAS folders that I would like my script to change the type settings on from 'Allow' to 'Deny' without changing the rules or the principal, but only for specific groups. The reason is that the folder belongs to an individual, and when that individuals AD account expires I want two of the groups that had access to it to no longer have access. Once the individual's AD account is reactivated, the script will "flip" the type back from "Deny" to "Allow". I have figured out how to extract the info, but having a hard time setting it:</p>
  
  <pre><code>$i = 0
  $acl = get-acl c:\scripts
  for($i = 0; $i -lt $acl.Access.Count; $i++){
      Write-Host $acl.Access.IdentityReference.GetValue($i)
      Write-Host $acl.Access.AccessControlType.GetValue($i)
      Write-Host $acl.Access.FileSystemRights.GetValue($i)
  }
  </code></pre>
  
  <p>This will spit out each security principal, the type (allow or deny), and the rights either as "Full Control", "Read", "Modify", etc., or numerically if special rights. I've tried to use .SetValue without success. Can anyone help me with the syntax to set the value for AccessControlType (allow or deny)? Thanks in advance.</p>
  
  <p>Edit: have tried something like the following without luck (to set the first one on the list):</p>
  
  <pre><code>$acl.Access.AccessControlType.SetValue(0)=1
  Set-Acl -Path c:\scripts -AclObject $acl
  </code></pre>