SharePoint powershell script to find unique permissions in sharepoint

#This script loops through all the sites in a site collection and then writes out any that have unique permissions.
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) | out-null
$siteurl = “Enter URL Here”

$site=new-object Microsoft.SharePoint.SPSite($siteurl)

foreach($web in $site.AllWebs)
{
if ($web.HasUniqueRoleAssignments)
{
“Site ” + $web.Url
}
foreach($list in $web.Lists)
{
if ($list.HasUniqueRoleAssignments)
{
“List ” + $list.Title
}
foreach ($item in $list.Items)
{
if ($item.HasUniqueRoleAssignments)
{
“Item ” + $item.Name + ”  ” + $item.Title
}
}
}
$web.Dispose()
}
$site.Dispose()

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami