Find All Sites and Lists with Unique Permissions

Requirement is to Get the report of SharePoint 2010 (or 2007) Sites and Lists where Permission Inheritance is broken.

PowerShell to Generate report for Unique Permissions:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

 #Get All Web Applications
$webApps = Get-SPWebApplication #"http://sharepoint.company.com"

#Write Header to CSV File 
"Site/List `t Title `t URL" | out-file UniquePermissions.csv

foreach ($webApp in $webApps)
{
    foreach ($site in $webApp.Sites)
    {
       foreach ($web in $site.AllWebs)
        {
   if ( ($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false))
   {
      $result ="Site `t $($web.Title) `t $($web.Url)"
      $result | Out-File UniquePermissions.csv -Append 
      #You can get the permissions applied by: $web.permissions | format-list member, basepermissions
   }
    foreach ($list in $web.Lists)
     {
     if (($list.HasUniqueRoleAssignments) -and ($list.Hidden -eq $false))
      {
        $result= "List `t $($list.Title) `t $($list.Url)" 
        $result | Out-File UniquePermissions.csv -Append 
      }
    }
    $web.Dispose()
  }
   $site.Dispose()
 }

}
       
and the Output file in Excel:
sharepoint find unique permissions
Find All Sites and Lists with Unique Permissions Find All Sites and Lists with Unique Permissions Reviewed by Salaudeen Rajack on October 02, 2012 Rating: 5

4 comments:

  1. How can we modify it to get folders and files inside that have unique permissions set??

    ReplyDelete
    Replies
    1. Thanks a lot but still i am stuck at item level scan. i made $scanfolders and $scanitemlevel to true but its not giving me the item level scan. Please help.

      Delete
    2. The script gets only objects with unique permissions.

      Delete

Please Login and comment to get your questions answered!

Powered by Blogger.