Scenario: You want to set NTFS permissions on a folder via Powershell. You want the permissions to inherit down to SubFolders and files as well.
Scriptlet:
$folder = "\FileSvr1filestest12345" $user = "DomainJdoe" # Get the ACL for an existing folder $existingAcl = Get-Acl -Path $folder # Set the permissions that you want to apply to the folder $permissions = $user, 'Read,Modify', 'ContainerInherit,ObjectInherit', 'None', 'Allow' # Create a new FileSystemAccessRule object $rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permissions # Modify the existing ACL to include the new rule $existingAcl.SetAccessRule($rule) # Apply the modified access rule to the folder $existingAcl | Set-Acl -Path $folder