PowerShell Script to list all lists and libraries with unique permissions

In order to know if your environment contains lists that are close the 64K ACL limit.
The following script might report the possible lists:

Note: List items with unique permissions is sheduled and will be integrated in this script.

cls
Write-Host "********************************************************************"
Write-Host "| This script will check if there are list with unique permissions |"
Write-Host "********************************************************************"
Write-Host
Write-Host "Loading Microsoft.SharePoint.PowerShell..." -ForegroundColor Yellow
Write-Host

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$siteURL = Read-Host "Please provide url of the SiteCollection"
$loglocation = Read-Host "Please provide path for the log file (hit ENTER to not store output)"
$site = Get-SPSite($siteURL)

Write-Host
if($loglocation -ne ""){
	start-transcript -path $loglocation
	Write-Host
}

Write-Host "--------------------------------------------------------------"

$counter = 0
Write-Host "The following lists and libraries have unique permissions `r`n (results marked in Red might have an 64K ACL impact):" -ForegroundColor Yellow
Write-Host

foreach($web in $site.AllWebs) {
	foreach($list in $web.Lists) {
		if($list.HasUniqueRoleAssignments -eq $true)
		{
			$counter = $counter + 1
			if($list.ItemCount > 1500){
				Write-Host $list.DefaultViewUrl "- ItemsCount:" $list.ItemCount -ForegroundColor Red "`r`n"
			}else{
				Write-Host $list.DefaultViewUrl "- ItemsCount:" $list.ItemCount "`r`n"
			}
		}else{
			#Write-Host $list.DefaultViewUrl -ForegroundColor Green	 "`r`n"	
		}
	}
}
Write-Host "--------------------------------------------------------------"

if($counter -lt 0){
	Write-Host $siteURL "has no lists or libraries with unique permissions!" -ForegroundColor Green
}else{
	Write-Host $siteURL "has $counter lists or libraries with unique permissions!"
}
Write-Host "--------------------------------------------------------------"

if($loglocation -ne ""){
	Stop-Transcript
}
Write-Host
VN:F [1.9.22_1171]
Rating: 6.9/10 (7 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 5 votes)