The script below was taken from https://www.lepide.com/how-to/get-an-ntfs-permissions-report-using-powershell.html
The script takes a directory path to search from, it will then get a list of all subdirectories, loop through each of them then generate a nice grid view report of all permissions in subdirectories and whether they are inherited.
$DirectoryToSearch = ""
$DirectoryPath = Get-ChildItem -Directory -Path $DirectoryToSearch -Recurse -Force
$Output = @()
ForEach ($Folder in $FolderPath) {
$Acl = Get-Acl -Path $Folder.FullName
ForEach ($Access in $Acl.Access) {
$Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
$Output += New-Object -TypeName PSObject -Property $Properties
}
}
$Output | Out-GridView
This should generate a report similar to the image below –

$DirectoryPath should be replaced as $FolderPath, nice script.
LikeLike