Force stop and then start a full crawl search in SharePoint 2013

Steps
  • Start your windows PowerShell on your computer.
  • Right click and select Run as administrator option.
  • Paste the below script on the PowerShell window and click the enter button.
  • Check your SharePoint site Feature will activated successfully
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
  1. Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | ForEach-Object {  
  2.     if ($_.CrawlStatus -ne "Idle")  
  3.     {  
  4.         Write-Host "crawl stooping currently for content source $($_.Name)..."  
  5.         $_.StopCrawl()  
  6.          
  7.         do { Start-Sleep -Seconds 1 }  
  8.         while ($_.CrawlStatus -ne "Idle")  
  9.     }  
  10.      
  11.     Write-Host "Full  crawl started for content source $($_.Name)..."  
  12.     $_.StartFullCrawl()  

Run the script and following script if you want to display the crawl status of all content sources on your farm:
  1. Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | select Name, CrawlStatus  
Ebook Download
View all
Learn
View all