SharePoint'te Liste Görünümü Arama eşiğini Aşan Tüm Listeleri Bul


Gereksinim:
SharePoint'teki kaynak azaltma özelliği, optimum kullanım için SharePoint Farm'daki kaynak kullanımını kontrol eder. Benim gereksinimim, SharePoint'te yapılandırılmış liste görünümü arama eşiği sınırını aşan tüm listeleri bulmaktı.

Liste Görünümü Arama eşiğini Aşan Tüm Listeleri bulmak için PowerShell betiği:

Bu komut dosyası, web uygulamasındaki tüm listeleri tarar ve listenin SharePoint 2013 merkezi yönetim sitesindeki web uygulaması kısıtlama ayarlarında yapılandırılan maksimum sayıyı aştığı tüm Liste Adlarını, URL'leri ve arama sütunlarını içeren bir CSV dosyası oluşturur.


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Get the Web Application
$WebApp = Get-SPWebApplication "https://portal.crescent.com"
 
#Array to Hold Result - PSObjects
$ListResults = @()

#Get the Throttling Limit of the Web App
$Threshold = $WebApp.MaxQueryLookupFields
 
    foreach($Site in $WebApp.Sites)
    {
        foreach($Web in $Site.AllWebs)
        {
            Write-host "Scanning site:"$Web.URL
             
            foreach($List in $Web.Lists)
            {
                #Get Number of Lookup Fields
                $LookupFields = $List.Fields | Where { $_.TypeDisplayName -eq "Lookup" -and $_.Hidden -eq $false}
                if($LookupFields.Count -gt $Threshold)
                {
                    $Result = New-Object PSObject
                    $Result | Add-Member NoteProperty Title($list.Title)
                    $Result | Add-Member NoteProperty URL($web.URL)
                    $Result | Add-Member NoteProperty Count($LookupFields.Count)
                     
                    #Add the object with property to an Array
                    $ListResults += $Result
                }
            }
        }
    }

Write-host "Total Number of Lists Exceeding Lookup Threshold:"$ListResults.Count -f Green
#Export the result Array to CSV file
$ListResults | Export-CSV "c:\ListData.csv" -NoTypeInformation

İlgili makaleler