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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s