Quantcast
Channel: SharePoint Legacy Versions - Using SharePoint Designer, InfoPath and Other Customizations Forum
Viewing all articles
Browse latest Browse all 2319

powershell to get folder/file names having unique permission in a nested folder structure of a document library in moss 2007

$
0
0

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() 


Viewing all articles
Browse latest Browse all 2319

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>