Welcome › Forums › General PowerShell Q&A › Assign user ACL permissions to a folder and sub directory using powershell
This topic contains 1 reply, has 2 voices, and was last updated by
Using a powershell script, I would like to add read and execute permission to a folder and its sub directories.
I user the following code:
$path = "\\domain.com\users\users1\test54"
$user = "email@example.com"
$Rights = "Read, ReadAndExecute, ListDirectory"
$InheritSettings = "Containerinherit, ObjectInherit"
$PropogationSettings = "None"
$RuleType = "Allow"
$acl = Get-Acl $path
$perm = $user, $Rights, $InheritSettings, $PropogationSettings, $RuleType
$rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $perm
$acl | Set-Acl -Path $path
However, when I execute this code (my account has admin level access), the ACL for this folder does not include the account test54.
What needs to be done so that I can add the user with access rights Read /List/Execute to the ACL of the specified folder?
Thanks in advance!
Can yo try AddAccessRule() method.
You must be logged in to reply to this topic.