Thursday, 16 February 2012

Resetting the SharePoint 2010 search index using PowerShell

The script here resets the SharePoint 2010 search index, which I have posted as there is no out-of-the-box cmdlet for doing this. This effectively does the same thing as the Index Reset option for the search service application in Central Administration:

ResetIndex

Note there are two parameters you can specify in the Reset method:

  • Disable alerts: $true if the Search alerts should be disabled during reset; otherwise, $false. Selecting $true here is the same as ticking the “Deactivate search alerts during reset” checkbox shown in the screenshot above.
  • Ignore unreachable server: $true if the failures to connect to servers are ignored; otherwise, $false.

In the script example I have added below, both options are set to $false. Note that running this script will permanently delete all crawled data in the search service application – you will need to re-crawl your content sources to get it back.

#Get the search service application
#You will need to specify the -Identity switch and a name if you have more than one
$sa = Get-SPEnterpriseSearchServiceApplication

#Reset index with the following options in brackets:
#Disable Alerts $true/$false
#Ignore unreachable server $true/$false
try
{
    Write-Host "Attempting to reset the index...please wait"
    $sa.Reset($false, $false)
    Write-Host "Index successfully reset" -ForegroundColor Blue
}
catch
{
    Write-Host "There was a problem resetting the index:" $_ -ForegroundColor Red
}

16 comments:

  1. How would you do this for SharePoint Foundation 2010 ?

    ReplyDelete
  2. Is anything else required to do to get crawls to properly index content again???? Thank you, Tom

    ReplyDelete
  3. Very clear explanation about Resetting the SharePoint 2010 search index using PowerShell.
    SharePoint Online Training

    ReplyDelete
  4. Gucci's Alessandro Michele didn't just roll out a colorful collection we can picture on the red carpet. For giuseppe shoes Fall '16, he collaborated with street artist GucciGhost, aka Trouble Andrew, cheap louboutin shoes appealing to the playful customer who's more bold than classic.Andrew began christian louboutin sale putting his own spin on the iconic GG logo after cutting red bottom shoes christian louboutin two holes in a thrifted Gucci sheet on Halloween and telling everyone he was the "Gucci Ghost." Since then, he's covered walls, trash valentino boots cans, and his own Instagram feed with his signature handwritten print. And when Michele, who was nothing but flattered by the graffiti, invited Andrew to decorate pieces for christian louboutin outlet his new line, Gucci Ghost showed up to the studio like christian louboutin sale it was NBD, crafting what are sure to be must-have pieces valentino shoes on every style star's wish list.Read on to get a first red bottom shoes for women look at the Gucci Ghost designs while they're hot off the christian louboutin runway, from a patterned pleated midi skirt and an edgy statement coat to a leather tote and square satchel.
    Adriana Lima can christian louboutin Shoes make herself look like a totally different person with a simple louboutin sale change of clothes, a variation on her lipstick, or a subtle red sole shoes christian louboutin hair change — that's probably why fashion designers are always choosing

    ReplyDelete