I am having a document library which has nested folders and in some of the folders or items have unique permissions.
However, my code below is only showing the folders and files at the first level; i want a recursive procedure to find out folder if not file which has unique permissions and if it has permission; list all the permissions.
Could you please let me know, if we could get it using powershell on Moss 2007.
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null $site = new-object Microsoft.SharePoint.SPSite("<site collection url>") $web = $site.OpenWeb("<Site>") $list = $web.Lists["Shared Documents"] $rootFolder = $list.RootFolder #Iterating through the required documents sets foreach ($docsetFolder in $rootFolder.SubFolders) { write-host $docsetFolder.Item.Title if($docsetFolder.Item.Title -eq "SLT") { write-host -f Yellow `t $docsetFolder.Name #Iterating through the files within the document sets foreach ($document in $docsetFolder.Files) { if(!$document.HasUniqueRoleAssignments) { #write-host -f Red `t " ..permissions inheritance detected. Process skipped" } else{ write-host -f Cyan `t " " $document.Name } } } } $web.Dispose() $site.Dispose()