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

[玩转系统] 使用 PowerShell 在 SharePoint 2013 中配置资源限制

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

使用 PowerShell 在 SharePoint 2013 中配置资源限制


什么是资源限制?
大型列表始终是 SharePoint 中的性能杀手。幸运的是,从 SharePoint 2010 开始,引入了一个名为“Throttting”的功能来解决这个问题。

任何超过 2000 行的操作(例如数据检索、更新、删除)都会导致 SharePoint 2007 天内的性能低下。限制定义用户一次可以查询的最大行数,超出此计数的任何操作都会显示错误消息。 SharePoint 2010 中此设置的默认值为 5000。

我们通过导航到以下位置来管理 SharePoint 2013 中的资源限制设置:

  • 管理中心 >> 管理 Web 应用程序 >> 选择目标 Web 应用程序
  • 在功能区中,单击常规设置 >> 资源限制

[玩转系统] 使用 PowerShell 在 SharePoint 2013 中配置资源限制

使用 PowerShell 配置列表限制设置:

使用以下脚本通过 PowerShell 配置 SharePoint 2013 的资源限制设置


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Function to set Resource throttling values in SharePoint 2013
Function Set-ResourceThrottling
{
param (
[parameter(Mandatory=$true)] [string]$WebAppURL,
[parameter(Mandatory=$true)] [string]$ListViewThreshold,
[parameter(Mandatory=$true)] [boolean]$AllowOMOverride,
[parameter(Mandatory=$true)] [string]$ListViewThresholdForAdmins,
[parameter(Mandatory=$true)] [string]$MaxLookupFields
)

#Get the Web Application
$WebApp = Get-SPWebApplication $WebAppURL

#Set List View Threshold 
$WebApp.MaxItemsPerThrottledOperation = $ListViewThreshold

#Enable Object Model Override
$WebApp.AllowOMCodeOverrideThrottleSettings= $AllowOMOverride

#Set List View Threshold  for Admins
$WebApp.MaxItemsPerThrottledOperationOverride = $ListViewThresholdForAdmins

#Set List View Lookup Threshold
$WebApp.MaxQueryLookupFields = $MaxLookupFields #List View Lookup Threshold

$WebApp.Update()

Write-Host "Throttling settings has been updated on" $WebApp.URL
}

#Call the function to configure resource throttling values
Set-ResourceThrottling "https://intranet.crescent.com" "6000" $true "25000" "10" 

在列表级别启用/禁用限制:

我们无法对特定 SharePoint 列表或库设置限制。但我们可以禁用/启用它的限制。以下是我的 PowerShell 脚本,用于禁用特定列表上的资源限制:禁用列表限制以访问 SharePoint 2010/2013 中的大型列表

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

取消回复欢迎 发表评论:

关灯