I am looking for some code to find all users or Ad Group who have some sort of permission in specific folder (with broken Permission) in a specific library of a team-site. With the following code I can find all the folder within a library that has unique permission (Broken Inheritance)
$web = Get-SPWeb $SiteURL #$($SiteIdentity.Url)
Write-Host "Site: " $web.Title
#$list = $web.Lists["Shared Documents"]
$list = $web.GetList($web.Url +"/Documents/")
write-host "Library Title: "$list.Title
$list.Folders | ft Name, HasUniqueRoleAssignments, Folder
But not getting the list of users/AD group those have some sort of(read , contrib etc) permission on that specific folder.