Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ChangeACL.ps1
- $Right="FullControl"
- $StartingDir=Read-Host "C:testusers.csv"
- $Principal=Read-Host "Full Control" `
- "$Right to? `n U contosotest"
- $rule=new-object System.Security.AccessControl.FileSystemAccessRule
- ($Principal,$Right,"Allow")
- foreach ($file in $(Get-ChildItem $StartingDir -recurse)) {
- $acl=get-acl $file.FullName
- #Add this access rule to the ACL
- $acl.SetAccessRule($rule)
- #Write the changes to the object
- set-acl $File.Fullname $acl
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement