How do I Find all the Non Inherited perms on a list of dirs.


COMMENT: Finds all the Non Inherited perms on a list of dirs.
Change where {$_.IsInherited -ne $true} to where {$_.IsInherited -eq $true} for Inherited perms.
Or you can use ? instead of where ie. ? {$_.IsInherited -eq $true}
==============================================================================================
#>
###### Start Posh Script ########

$result = @()
$paths = gc C:\scripts\ps1\dirs.txt
foreach ($path in $paths) {
$all = dir $path -rec
$dirs = $all | ? {$_.psiscontainer -eq "true"}
$result += $dirs | Get-Acl | %{$_.Access | Add-Member -MemberType NoteProperty Path -Value ($_.Path -replace ".+::") -PassThru} |
select Path,FileSystemRights,AccessControlType,IdentityReference,IsInherited,InheritanceFlags,PropagationFlags |
where {$_.IsInherited -ne $true}
}

$result | Export-Csv mypaths.csv –NoTypeInformation