Export SharePoint 2007 Search Crawl History using PowerShell
Here is the PowerShell script to export Search crawl history in SharePoint 2007 using PowerShell:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search")
function global:Get-CrawlHistory($url)
{
#Objects to get Crawl History
$site = new-Object Microsoft.SharePoint.SPSite($url);
$context = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($site);
$history = new-Object Microsoft.Office.Server.Search.Administration.CrawlHistory($context);
Write-OutPut $history.GetCrawlHistory()
#Dispose site object
$site.Dispose()
}
#Call the function to get Crawl History
Get-CrawlHistory -url "https://sharepoint.crescent.com" | Export-CSV "d:\Reports\CrawlLog.csv"
This gives data such as: CrawlType (2 – Increment, 1- FULL), ContentSourceID ( 4 – Local Crawls, 10 -People search), Status, Start Time, End Time, Success Count, Error Count, Warning Count of last 8 crawls.