Connect-PnPOnline "https://tenant.sharepoint.com/sites/meineseite" -Interactive
# Skip these list names
$skipTheseLists = @(
"Style Library",
"Form Templates",
"Site Assets",
"Site Pages"
)
# Iterate through all lists
Get-PnPList -Includes HasUniqueRoleAssignments | Where-Object { $_.Hidden -eq $false -And -Not $skipTheseLists.contains($_.Title) } | ForEach-Object {
Write-host "Checking for Items with UniqueRoleAssignments in List $($_.Title)"
#Iterate through all items
Get-PnPListItem -List $_.Title -PageSize 2000 | ForEach-Object {
$HasUniquePermissions = Get-PnPProperty -ClientObject $_ -Property "HasUniqueRoleAssignments"
If ($HasUniquePermissions) {
Write-Host -f Green "Item($($_.ID)) '$($_["Title"])' has Unique Permissions"
}
}
}