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

[玩转系统] 使用 PowerShell 禁用 SharePoint Server 中的连续爬网?

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

使用 PowerShell 禁用 SharePoint Server 中的连续爬网?


SharePoint 中的连续爬网有助于使搜索结果保持最新。另一篇文章中解释了配置连续爬网:在 SharePoint 2016 中配置连续爬网。在某些情况下,例如维护、索引重置等,您可能必须在 SharePoint 中关闭连续爬网。

如何使用 PowerShell 在 SharePoint 2016 中禁用连续爬网?

要禁用对特定 SharePoint 内容源的连续爬网,请执行以下步骤:

  • 以场管理员身份登录到 SharePoint 2013 管理中心。在管理中心的“应用程序管理”下,单击“管理服务应用程序”,然后选择您的搜索服务应用程序
  • 在“搜索服务管理”页面上,单击左侧导航菜单的爬网部分下的“内容源”链接。
  • 在“管理内容源”页面中,单击要禁用连续爬网的 SharePoint 内容源中的下拉箭头。
  • 选择禁用连续爬网并通过单击确定确认您要禁用连续爬网。您还可以通过从编辑内容源页面中选择增量爬网选项来禁用连续爬网,这将禁用连续爬网。

    [玩转系统] 使用 PowerShell 禁用 SharePoint Server 中的连续爬网?

SharePoint 2013 禁用使用 PowerShell 的连续爬网:

使用此 PowerShell 脚本可禁用对 SharePoint 2013 或 SharePoint 2016 中特定内容源的连续爬网。


#Get Search service application
$SSA =  Get-SPEnterpriseSearchServiceApplication
 
#Get the content source by name
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SSA -Identity "Local SharePoint sites"
 
#Check if Continuous Crawls is already disabled
if($ContentSource.EnableContinuousCrawls -eq $False)
{
    Write-host "Continuous Crawl is already Disabled on this content source!" -ForegroundColor Red
}
else
{
    #Disable continuous crawl sharepoint 2013
    Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $False
    Write-host "Disabled Continuous Crawl Successfully!" -ForegroundColor Green
}

使用 PowerShell 禁用连续爬网 SharePoint 2016

让我们禁用所有 SharePoint 内容源的连续爬网。


#Get Search service application
$SSA =  Get-SPEnterpriseSearchServiceApplication

#Get all SharePoint content sources
$SPContentSources = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SSA | Where-object {$_.Type -eq "SharePoint"} 

foreach ($ContentSource in $SPContentSources) 
{ 
    #Check if Continuous Crawls is disabled already
    if($ContentSource.EnableContinuousCrawls -eq $false)
    {
     Write-host "Continuous Crawl is already Disabled for $($ContentSource.Name)!" -ForegroundColor Yellow
    }
    else
    {
        #disable continuous crawl sharepoint 2013
        Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $False
     Write-host "Disabled Continuous Crawl Successfully for $($ContentSource.Name)" -ForegroundColor Green
    }
}

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

取消回复欢迎 发表评论:

关灯