1 2 3 4 5 6 7 8 9 10 11 12 13 |
$AllFolders = Get-ChildItem -Directory -Path "S:\" -Recurse -Force $Results = @() Foreach ($Folder in $AllFolders) { $Acl = Get-Acl -Path $Folder.FullName foreach ($Access in $acl.Access) { if ($Access.IdentityReference -notlike "BUILTIN\Administrators" -and $Access.IdentityReference -notlike "domain\Domain Admins" -and $Access.IdentityReference -notlike "CREATOR OWNER" -and $access.IdentityReference -notlike "NT AUTHORITY\SYSTEM") { $Properties = [ordered]@{'FolderName'=$Folder.FullName;'AD Group'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited} $Results += New-Object -TypeName PSObject -Property $Properties } } } $Results | Export-Csv -path "C:\Permissions - $(Get-Date -format MMyy).csv" |