I made this so that it could be imported into an Excel CSV file. During the import the first row can be removed. Once its imported and inside the spreadsheet one may sort the table accordingly and shift from view to view showing the groups and users who have access as well as the level of access. I got it accomplished with this:
$directory = Read-Host 'Which directory would you like me to retrieve the ACL from?'
Write-Host " "
Write-Host "The ACL of your directory will be saved in Get_Directory_ACL_Output.csv on Local Disk (C:\)."
Write-Host " "
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Get-childitem $directory -recurse | where{$_.psiscontainer} |
Get-Acl | % {
$path = $_.Path
$_.Access | % {
New-Object PSObject -Property @{
Folder = $path.Replace("Microsoft.PowerShell.Core\FileSystem::","")
Access = $_.FileSystemRights
Control = $_.AccessControlType
User = $_.IdentityReference
Inheritance = $_.IsInherited
}
}
} | ? {-not $_.Inheritance} | export-csv C:\Get_Directory_ACL_Output.csv -force
It pulls generic permissions in a number format. These permissions are below:
-1610612736 GENERIC_EXECUTE
–536805376 Modify_Synchronize
268435456 Modify_Synchrronize