Tag Archives: Equalit

User ACL Permission Script

$Users = Get-Content "C:user1.txt"
 ForEach ($user in $users)
 {
 $newPath = Join-Path "c:testlocation" -childpath $user
 New-Item $newPath -type directory

$nuser = "gandalf" + $user
 $Access=[System.Security.AccessControl.AccessControlType]"Allow"
 $Rights=[System.Security.AccessControl.FileSystemRights]"FullControl"
 $Prop=[System.Security.AccessControl.PropagationFlags]"NoPropagateInherit"
 $Inherit=[System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
 $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($nuser,$Rights,$Inherit,$Prop,$Access)
 $acl = Get-Acl $newpath
 $acl.AddAccessRule($accessRule)
 Set-Acl $newpath -AclObject $acl
 }