Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $HomeFolders = Get-ChildItem C:Homefolders -Directory
  2. foreach ($HomeFolder in $HomeFolders) {
  3.     $Path = $HomeFolder.FullName
  4.     $Acl = (Get-Item $Path).GetAccessControl('Access')
  5.     # $Username = $HomeFolder.Name
  6.     $Ar = New-Object System.Security.AccessControl.FileSystemAccessRule('jacobf', 'Modify', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
  7.     $Acl.SetAccessRule($Ar)
  8.     Set-Acl -path $Path -AclObject $Acl
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement