Sunday, March 13, 2016

Enable Continuous Crawl in SharePoint 2013 using PowerShell

Continuous Crawl was introduced in SharePoint 2013 to keep the search results as fresh as possible.
To enable Continuous crawl in SharePoint 2013, follow these steps:

  • Login to SharePoint 2013 Central Administration as a Farm Administrator. In Central Administration, Click on Manage service applications under the Application Management tab
  • Click on your Search service application.
  • In the Search Service Administration page, click on Content Sources link from the left navigation.
  • On the Manage Content Sources page, click the SharePoint content source to which you want to enable continuous crawl.
  • Scroll down and select "Enable Continuous Crawls" option under the Crawl Schedules section.
    sharepoint 2013 enable continuous crawl powershell
  • Click OK to save your changes.
SharePoint 2016: Enable continuous crawl with PowerShell
Here is the PowerShell script to enable continuous crawl in SharePoint 2013 or 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 enabled
if($ContentSource.EnableContinuousCrawls -eq $true)
{
 Write-host "Continuous Crawl is already Enabled for this content source!" -ForegroundColor Red
}
else
{
        #enable continuous crawl sharepoint 2013
        Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $True
        Write-host "Enabled Continuous Crawl Successfully!" -ForegroundColor Green
}

Enable continuous crawl for all SharePoint 2013 content sources using PowerShell
While the above script enables Continuous crawl for given content source name, Lets enable continuous crawl for all SharePoint content source in SharePoint 2016:
#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 already enabled
    if($ContentSource.EnableContinuousCrawls -eq $true)
    {
 Write-host "Continuous Crawl is already Enabled for $($ContentSource.Name)!" -ForegroundColor Yellow
    }
    else
    {
        #enable continuous crawl sharepoint 2013
        Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $True
        Write-host "Enabled Continuous Crawl Successfully for $($ContentSource.Name)" -ForegroundColor Green
    }
}



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...