Friday, December 25, 2015

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

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

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...