Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cd \\cifspath\users
- Get-Childitem \\cifspath\users\ | % {
- $current_folder = $_.BaseName
- # Remove inheritance
- $acl = Get-Acl $_
- $acl.Access | % {
- $FileSystemRights = $_.FileSystemRights
- $IdentityReference = $_.IdentityReference
- if (($IdentityReference -eq 'BUILTIN\Administrators') -or ($IdentityReference -eq 'DOM\domain admins') -or ($IdentityReference -eq 'DOM\root')){
- Write-Debug "Skipping admins"
- } else {
- $obj = [PSCustomObject]@{
- FolderName = $current_folder
- UserWithPerms = $IdentityReference
- UsersPermissions = $FileSystemRights
- }
- Write-Output $obj
- }
- }
- }
Add Comment
Please, Sign In to add comment