Export SharePoint 2013 Search Crawl History to CSV using PowerShell

Requirement: Extract crawl history of SharePoint 2013 search service application to a CSV file.

sharepoint 2013 export search crawl history to csv

PowerShell to Extract Last 10 Crawl Log History to CSV file:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Parameters
$ContentSourceName = "Local SharePoint sites"
$ResultsCount = 10

#Get Search Service application and Content Source
$SearchServiceApplication = Get-SPEnterpriseSearchServiceApplication
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchServiceApplication | ? { $_.Name -eq $contentSourceName }

#Get Crawl History
$CrawlLog = new-object Microsoft.Office.Server.Search.Administration.CrawlLog($searchServiceApplication)
$CrawlHistory = $CrawlLog.GetCrawlHistory($ResultsCount, $ContentSource.Id)

#Export the Crawl History to CSV
$CrawlHistory | Export-CSV "C:\CrawlHistory.csv" -NoTypeInformation

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “Export SharePoint 2013 Search Crawl History to CSV using PowerShell

  • Nice script to have. I will note that on the output, if you see an end time of 12/31/9999, that means that content source has been paused.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *