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) }
This is throwing below error. :(
ReplyDeleteGet-SPEnterpriseSearchCrawlContentSource : Cannot convert 'System.Object[]' to the type 'Microsoft.Office.Server.Search.Cmdlet.SearchServiceApplicationPipeBind' required by
parameter 'SearchApplication'. Specified method is not supported.
At line:8 char:93
+ ... rchApplication $SSA
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-SPEnterpriseSearchCrawlContentSource], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Office.Server.Search.Cmdlet.GetSearchCrawlContentSource
You cannot call a method on a null-valued expression.
At line:10 char:1
+ $source.StartAddresses.Clear()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull