Partial "Index Reset" (per ContentSource or StartAddress)


This script will remove and re-add your content source's start addresses.

SharePoint will more or less rebuild the index for these sources, when a full crawl is started.

 

 

$sourceName = "Local SharePoint sites"

 

$SSA = Get-SPEnterpriseSearchServiceApplication

$source = Get-SPEnterpriseSearchCrawlContentSource -Identity $sourceName -SearchApplication $SSA

$startaddresses = $source.StartAddresses | ForEach-Object { $_.OriginalString }

$source.StartAddresses.Clear()

ForEach ($address in $startaddresses ){ $source.StartAddresses.Add($address) }


Comments (2)
  1. Conway says:

    Doesn’t SharePoint rebuild indexes when full crawl happens anyway?

  2. RM Summers says:

    I get an error after executing the last line:

    At line:1 char32
    + $source.StartAddresses.Clear() ForEach ($address in $startaddresses ){ $source.StartAddresses.Add($address) }
    +
    Unexpected token ‘ForEach’ in expression or statement.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Comments are closed.

Skip to main content