ACL Entries

I use the following command to get ACL entries on folders and sub folders at a specified location.

Get-ChildItem "filepath" -recurse -exclude *.* | ForEach-Object {Get-Acl $_.FullName} | ft -Wrap | Out-File C:\Temp\Permissions.txt -Width 375

Is there a way to have it return only non inherited entries?
LVL 3
LindySAsked:
Who is Participating?
 
slidingfoxConnect With a Mentor Commented:
OK, give this one a try

$paths = Get-ChildItem "filepath"

$output = @()

ForEach ($path in $paths) {
    
    $acl = Get-ACL $path.FullName
    
    $isInherited = $False
    
    ForEach ($item in $acl.Access) {
    
        if ($item.IsInherited) {
            $isInherited = $True
        }
    }
    
    if (-not $isInherited) {
        $output += $acl
    }
}

$output | ft -Wrap | Out-File C:\Temp\Permissions.txt -Width 375 

Open in new window

0
 
slidingfoxCommented:
Try this
Get-ChildItem "filepath" -recurse -exclude *.* | 
ForEach-Object {
    Get-Acl $_.FullName |
    ForEach-Object {
        $_.Access | Where-Object { -not ($_.IsInherited) }
    }
} | 
ft -Wrap | 
Out-File C:\Temp\Permissions.txt -Width 375

Open in new window

0
 
LindySAuthor Commented:
Not quite what I needed.
I have attached two files. Users_Folder_ACL.txt is what i get when I run the original command.

When I run your suggested command I get the results in permissions.txt.

I need to get the same information I get with the original command, I would just prefer to get only the non-inherited entries.
Permissions.txt
Users-Folder-ACL.txt
0
 
LindySAuthor Commented:
That is exactly what I wanted...Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.