A PowerShell script to check the crawl status of a content source for search

How to automate a tedious task with SharePoint and FAST Search

Agnes Molnar

by Agnes Molnar on 3/31/2014

Share this:

Article Details

Date Revised:

Applies to:
FAST Search, Microsoft, Microsoft SharePoint, PowerShell, Search, SharePoint 2010, spx, Windows PowerShell

As you know, I play work with SharePoint/FAST Search a lot. I have a lot of tasks that require me to sit on the button F5 while crawling and checking the status: Has it started? Is it still crawling? Has it finished yet?

To really keep track, I'd have to hit F5 every minute. I’m too lazy for that, so I decided to write a PowerShell script that does nothing but check the crawl status of a Content Source and write it to the console for me. Now I can work on my second screen while it’s working and working and working - without touching F5.

The script is pretty easy:

$SSA = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application" $ContentSource = $SSA | Get-SPEnterpriseSearchCrawlContentSource -Identity "My Content Source"
do {     Write-Host $ContentSource.CrawlState (Get-Date).ToString() "-" $ContentSource.SuccessCount "/"$ContentSource.WarningCount "/" $ContentSource.ErrorCount     Start-Sleep 5 } while (1)

Yes, it works fine for FAST (FS4SP) Content Sources, too.

Topic: Tutorial

Sign in with

Or register