Monday, March 13, 2017

Reset Search Index in SharePoint 2013 using Powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
 
#Get Search service application
$ssa = Get-SPEnterpriseSearchServiceApplication
 
#Content Source Name
$ContentSourceName "SPSite"
 
#Get the content source
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -Identity $ContentSourceName -SearchApplication $SSA
 
#Get Each Start Address
$StartAddresses $ContentSource.StartAddresses | ForEach-Object { $_.OriginalString }
 
#Clear Indexed content starts with custom contnet source
$ContentSource.StartAddresses.Clear()
 
#Re-add the start address to content source
ForEach ($Address in $StartAddresses ){ $ContentSource.StartAddresses.Add($Address) }

No comments:

Post a Comment