Set NTFS permissions

Marek Jarek 1 Reputation point
2021-03-09T17:09:10.163+00:00

Hi all
I'd like to add new group with Full Control to folder's ACL and preserve inherited permissions. When I use Set-Acl or icacls inherited permissions are removed.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2021-03-09T22:35:51.827+00:00

    As discussed in the docs it takes the ACL to apply to the item as a parameter. If you want to keep the existing settings you need to start with the ACL that is already there and then add the new ACE to it. Using example 5 from the docs as a starting point.

       # Get the existing ACL  
       $acl = Get-Acl $target  
         
       # Create the new entry(ies)  
       $ace = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList "BUILTIN\Administrators", "FullControl", "Allow"   
       $acl.SetAccessRule($ace)  
         
       # Update the target  
       Set-Acl $target -AclObject $acl  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.