menu
Tech blog, musings & updates from Intelligent Decisioning
Want to work with Intelligent Decisioning? That’s great, let’s talk

Category Archives: Search

Start and Stop SharePoint Search Crawls with PowerShell

Share socially -

Quite often you may wish to start a SharePoint Search content crawl on demand, without waiting for the next scheduled crawl to start. You may still be running SharePoint Server 2010, or not able (or willing) to run a continuous crawl of your content.

To make your job that little bit quicker when it comes to starting a Search Crawl, you can easily start either Incremental or Full Crawls via PowerShell.

Simply retrieve the Content Source that you want to crawl, then invoke the appropriate method.

$cs = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" -Identity "Local SharePoint Sites"

# This method starts a full crawl
$cs.StartFullCrawl()

# This method starts an incremental crawl
$cs.StartIncrementalCrawl()

# Do this to stop any currently running crawls
$cs.StopCrawl()

# This property returns the status of your crawl
$cs.CrawlStatus

 

Obviously, change the SearchApplication parameter to match the name of your search application, and the “Identity” parameter to match the name of the specific Content Source you want to crawl.

You can wrap up all of the PowerShell lines that you need to kick off the crawl you want into a text file with the extension of “.ps1” and invoke from a SharePoint Administration Shell prompt whenever you need to!