Set-SPRoutingRule
更改现有路由规则的属性。
语法
Set-SPRoutingRule
[-Identity] <SPRoutingRulePipeBind>
[-AssignmentCollection <SPAssignmentCollection>]
[-Criteria <SPRequestManagementRuleCriteriaPipeBind[]>]
[-ExecutionGroup <Int32>]
[-Expiration <DateTime>]
[-MachinePool <SPRoutingMachinePoolPipeBind>]
[<CommonParameters>]
说明
Set-SPRoutingRule
使用 cmdlet 更改现有路由规则的属性。
有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet。
示例
--------------------示例---------------------
$wa = Get-SPWebApplication https://webAppUrl
$rm = Get-SPRequestManagementSettings -Identity $wa
Get-SPRoutingRule -RequestManagementSettings $rm
$machines = Get-SPRoutingMachineInfo -RequestManagementSettings $rm
$pool = Add-SPRoutingMachinePool -RequestManagementSettings $rm -Name <Name of Pool> -MachineTargets $machines
$criteria = New-SPRequestManagementRuleCriteria -Value http -Property url -MatchType startswith -CaseSensitive $false
$rule = Add-SPRoutingRule -RequestManagementSettings $rm -Name <Rule Name> -Criteria $c -MachinePool $pool
$criteriaNew = New-SPRequestManagementRuleCriteria -Property UserAgent -MatchType Equals -Value "Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 6.0 Robot)"
Set-SPRoutingRule -Identity $rule -Criteria $criteriaNew
此示例使用 $rule 变量设置指定标识的路由规则。
参数
-AssignmentCollection
管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。
在使用 Global 参数时,所有对象均包含在全局存储中。 如果未立即使用对象,或未通过使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Criteria
指定要匹配的规则的条件。
Type: | SPRequestManagementRuleCriteriaPipeBind[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ExecutionGroup
指定将在其中放置规则的组。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Expiration
指定规则的到期日期和时间。
Type: | DateTime |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Identity
指定要设置的请求管理设置对象的名称。
Type: | SPRoutingRulePipeBind |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-MachinePool
指定在匹配更改的规则时要将请求路由到的计算机池。
Type: | SPRoutingMachinePoolPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |