Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #ChangeACL.ps1
  2. $Right="FullControl"
  3. $StartingDir=Read-Host "C:testusers.csv"
  4. $Principal=Read-Host "Full Control" `
  5. "$Right to? `n U contosotest"
  6.  
  7. $rule=new-object System.Security.AccessControl.FileSystemAccessRule
  8. ($Principal,$Right,"Allow")
  9.  
  10. foreach ($file in $(Get-ChildItem $StartingDir -recurse)) {
  11. $acl=get-acl $file.FullName
  12.  
  13. #Add this access rule to the ACL
  14. $acl.SetAccessRule($rule)
  15.  
  16. #Write the changes to the object
  17. set-acl $File.Fullname $acl
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement