zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    【MySQL】MySQL之备份
    【MySQL】MySQL之导入和导出
    MySQL逻辑备份之MySQLDump
    【Perl】Linux下安装Perl
    【MySQL】MySQL NDB Cluster维护
    【MySQL】MySQL NDB Cluster安装
    Linux服务器开启ssh服务,实现ssh远程登陆!
    PDO异常处理
    PHP异常处理
    PDO中的事务处理
  • 原文地址:https://www.cnblogs.com/love007/p/2565678.html
Copyright © 2011-2022 走看看