当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 禁用 SharePoint 列表上的限制

作者:精品下载站 日期:2024-12-14 21:00:27 浏览:15 分类:玩电脑

使用 PowerShell 禁用 SharePoint 列表上的限制


限制功能有助于避免 SharePoint 中的性能下降。我们为整个 Web 应用程序设置限制,并且不可能对特定 SharePoint 列表或库设置限制。但我们可以禁用/启用 SharePoint 列表上的限制。

PowerShell 禁用列表限制:

使用以下脚本通过 PowerShell 禁用 SharePoint 2010 中的列表限制。


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for Site URL and List Name
$WebURL = "https://sales.crescent.com"
$ListName = "Proposal Documents"
 
#Get the Site and List objects
$web = Get-SPWeb $WebURL
$List = $Web.Lists[$ListName]

#Disable throttling on the list
$list.EnableThrottling = $false
$List.Update() 

查找禁用列表限制的所有列表

若要查找 SharePoint 环境中禁用列表限制的所有列表,请使用此 PowerShell 脚本。它会扫描当前环境中的所有 Web 应用程序以查找禁用限制的列表,并将结果导出到 CSV 文件。


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Get All Web Applications
$WebAppsCollection = Get-SPWebApplication
 
#Array to Hold Result
$ThrottlingLists = @()

#Loop through each web application 
foreach($WebApp in $WebAppsCollection)
{
    #Loop through each site collection 
    foreach($Site in $WebApp.Sites)
    {
	    #Loop through each web
        foreach($Web in $Site.AllWebs)
        {
            Write-host "Scanning site:"$Web.URL             
            foreach($List in $Web.Lists)
            {
                if($list.EnableThrottling -eq $False)
                {
                    $Result = New-Object PSObject
                    $Result | Add-Member NoteProperty Title($list.Title)
                    $Result | Add-Member NoteProperty URL($web.URL)                     
                    #Add the object with property to an Array
                    $ThrottlingLists += $Result
                }
            }
        }
    }
}
Write-host "Total Number of Lists with Throttling disabled:"$ThrottlingLists.Count -f Green
 
#Export the result Array to CSV file
$ThrottlingLists | Export-CSV "c:\temp\ThrottlingListData.csv" -NoTypeInformation

相关文章:使用 PowerShell 在 SharePoint 2013 中配置资源限制

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯