Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $usersid = New-Object System.Security.Principal.Ntaccount("ADDOMAIN\ad_user")
- $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($usersid,[System.Security.AccessControl.FileSystemRights]::ReadAndExecute, [System.Security.AccessControl.AccessControlType]::Allow)
- Get-ChildItem -Recurse -Directory . | % {
- Write-Host "Setting rights to $($_.FullName)"
- $fld = $_.FullName
- $acl = get-acl $fld
- $acl.PurgeAccessRules($usersid)
- $acl.SetAccessRule($accessRule)
- $acl | Set-Acl $fld
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement