#Set script variables $TenantAdminURL = "https://example-admin.sharepoint.com" $TenantURL = "https://example.sharepoint.com" $LargeListThreshold = 1000 $AppRegistrationId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" $CSVReportPath = ".\LargeListsReport.csv" $LargeListsReportData = @() Connect-PnPOnline -Url $TenantAdminURL -Interactive -ClientId $AppRegistrationId $SiteCollections = Get-PnPTenantSite -Filter "Url -like $TenantURL" ForEach($SiteCollection in $SiteCollections){ Connect-PnPOnline -Url $SiteCollection.Url -Interactive -ClientId $AppRegistrationId $SiteLists = Get-PnPList $LargeLists = $SiteLists | Where-Object {$_.ItemCount -gt $LargeListThreshold -and $_.Hidden -eq $False} ForEach($LargeList in $LargeLists){ $LargeListsReportData += [PSCustomObject]@{ Site = $SiteCollection.Title SiteURL = $SiteCollection.Url Library = $LargeList.Title LibraryUrl = $LargeList.ParentWebUrl ItemCount = $LargeList.ItemCount } Clear-Variable LargeLists } } #Export your large list report $LargeListsReportData | Export-Csv -Path $CSVReportPath -NoTypeInformation