Skip to content

Instantly share code, notes, and snippets.

@MaxMelcher
Created July 21, 2014 15:56
Show Gist options
  • Save MaxMelcher/21d388100a60cc746f2a to your computer and use it in GitHub Desktop.
Save MaxMelcher/21d388100a60cc746f2a to your computer and use it in GitHub Desktop.
Add-PSSnapin microsoft.sharepoint.powershell -ea 0
$ssa = Get-SPEnterpriseSearchServiceApplication | Where-Object {$_.Name -eq "Search Service Application"}
$id = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $ssa | ? { $_.Name -eq "Local SharePoint Sites"}
$log = New-Object Microsoft.Office.Server.Search.Administration.CrawlLog $ssa
Write-Host "Success:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, 0, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
$dt.Rows.Count | Out-String
Write-Host "Warnings:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, 1, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
$dt.Rows.Count | Out-String
Write-Host "Errors:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, 2, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
$dt.Rows.Count | Out-String
Write-Host "Deleted:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, 3, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
$dt.Rows.Count | Out-String
Write-Host "Everything:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, -1, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
$dt.Rows.Count | Out-String
$group = $dt | Group-Object "ErrorID"
$errors = $log.GetErrorMessages() # <= this guy returns an internal Type: Microsoft.Office.Server.Search.Administration.ErrorInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment