Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

according to that technet article it is possible to reset manually the content index.

I was wondering if that task could be plan to run once a week for instance, automatically?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I could find no OOB way to do this in stsadm or PowerShell, so you could either write a server specific custom timer job that does this at pre-scheduled interval, or create a PowerShell cmdlet that is called using schedule on the server that runs the Search Service Application.

using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.Search.Administration;

public static void ResetContent()
{

            try
            {
                SearchContext searchContext = SearchContext.GetContext(ServerContext.Default);
                searchContext.Reset(true);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Unable to reset content index.", ex);
            }

}

Source

Alternatively in PowerShell

$searchApp = Get-SPEnterpriseSearchServiceApplication -Identity “SearchAppName”                                                        

if($searchApp -ne $null) {

  $searchAppCtx = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($searchApp)

  $searchAppCtx.Reset($true)

}

Corey Roth also coded this functionality as a cmdlet in his SharePoint PowerShell Community Toolkit

share|improve this answer
add comment

didn't try, but you can try in powershell:

$searchapp = Get-SPEnterpriseSearchServiceApplication
$searchapp.Reset($true, $false)

then you can schedule the powershell command

share|improve this answer
    
beat me by 43 sec ;-) –  Anders Rask Jun 22 '11 at 10:05
1  
@anders rask: as your answer is more complete than mine, let's say the score is 1:1 (and user472285 be the judge to mark as answer) :) –  Steve B Jun 22 '11 at 10:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.