Force stop and start a full crawl on content sources in SharePoint 2013 using PowerShell


Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | ForEach-Object {
    if ($_.CrawlStatus -ne "Idle")
    {
        Write-Host "Stopping 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 Status

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

Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell