• Force stop and then start a full crawl on all content sources in a SharePoint 2010 farm using PowerShell(转)


    have been many times where I have needed to run a full crawl of all content sources on a SharePoint 2010 farm, but I quite often there are already crawls taking place, which I prefer to stop before starting a new one.

    The script below walks through each content source and does the following:

    1. Checks whether the crawl status is set to “Idle”
    2. If the content source is currently involved in a crawl activity, stop the activity and wait until the status changes back to Idle
    3. If the content source is Idle, then start a full crawl

    To use, run the following script in the SharePoint Management Shell, replacing “Search Service Application” with the name of your Search service application:

    Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | ForEach-Object

    {
    if ($_.CrawlStatus -ne "Idle")
    {
        Write-Host "Stopping currently running crawl for content source $($_.Name)..."
        $_.StopCrawl()
       do { Start-Sleep -Seconds 1 }
       while ($_.CrawlStatus -ne "Idle")
    }

    Write-Host "Starting full crawl for content source $($_.Name)..."

    $_.StartFullCrawl()
    }

    For info, you can use the following script if you want to display the crawl status of all content sources on your farm:

    Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | select Name, CrawlStatus

    This will give you an output similar to the following:

    image

  • 相关阅读:
    spring boot-11.全局捕获异常
    spring boot-10.国际化
    spring boot-9.对springMVC的支持
    spring boot-8.静态资源映射
    spring boot-7.日志系统
    spring boot-6.profile 多环境支持
    spring boot-4.配置文件
    spring boot-3.原理探究
    【C/C++】产生随机数
    【C/C++】获取当前系统时间
  • 原文地址:https://www.cnblogs.com/love007/p/2565678.html
Copyright © 2020-2023  润新知