Reprovision sharepoint search service

Reprovision sharepoint server search service when there is a situation where you find status of sharepoint server search service in stopping state. When there is an issue in search service application and its component due to which sharepoint search is not working. You need to restart service sharepoint server search. While restart, you find the sharepoint server search service stuck stopping state. In that case this post is helpful.

Advertisements

Restart sharepoint server search service

Run below script to restart or reprovision sharepoint server search service.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$SearchServiceInstance = Get-SPEnterpriseSearchServiceInstance -Identity "WIN-Q2REPGHF9DU"
Start-SPEnterpriseSearchServiceInstance -identity $SearchServiceInstance # Wait for search service instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -identity $SearchServiceInstance; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")
Advertisements

Once script started running, you will find the details as seen in figure below.

sharepoint server search service status stopping
Advertisements

The service sharepoint server serach will be stopped first, then will chanage to state starating and finally will come to status as Started.

sharepoint server search service
Advertisements
Advertisements

reset search index all crawled content source in sharepoint 2019 powershell

reset search index in sharepoint 2019 for all crawled content source is a critical task. You know there are 6 search components like crawl component,content processing component,analytics processing component, index component, query processing component, search administration component in search topology. When user query something, results retrieving from index files. Administrator adds content source, crawling happens, indexing happening. In case of corrupt index , status of index component is degraded, search result not coming, sharepoint index partition yellow triangle appears, we have to perform this activity. We can follow UI method from search administration page for index reset but timeout error might come. We can use powershell command to clear indexed results for all crawled content source.

Advertisements

Pre-Index Reset Task

Before doing index reset, make sure below check points satisfying

  • Crawl status for content source is idle.
  • Crawler background activity status is none.
  • Disable crawl schedule otherwise. recent crawl rate should be 0 items per second.
  • Recent query rate should be 0 queries per minute
  • Administrative status should not be running. Suspend search service application if its running mode by running beow command.
Suspend-SPEnterpriseSearchServiceApplication "Search Service Application"
Advertisements
suspend search service application
crawl status is idle
crawl status disabled
Advertisements

Navigate to manage service application from central administrator in sharepoint 2019. Click on search service application, you will be redirected to search service application administrator page. validate the pre-index reset task checks.

index reset task search administration

After that, its good to proceed for reset indexing in sharepoint search.

Advertisements

Index Reset Task

We can do this by UI method or by using powershell command. let’s underatand both methos.

UI method from Search Administration Page

click on “Index reset” from left navigation.

index reset tasak search administration sharepoint 2019
Advertisements

Deactivate search alerts by selecting the checkbox to stop alerts. Its very important to diable alerts without any miss and click on “Reset Now” from searchreset page.

reset now
Advertisements

index files will be cleared, once process completed. Click on “Crawl log” and you will find last crawl field reset to “No data”. Crawl properties like successes, warnings, errors, top level errors, deletes reset to “0”.

crawl log in sharepoint server 2019

search index reset timeout might come in UI method, so better to use powershell command method.

Advertisements

Powershell command to reset search index

We can use powershell command to delete search index files for all crawled content source. Find below the powershell command.

(Get-SPEnterpriseSearchServiceApplication).reset($true, $true)
# $True: Disable Alerts and Ignore Timeout error
search index reset using powershell in sharepoint 2019 on-premises
Advertisements

Post-Index Reset Task

After clearing or resetting search index, always have to start full crawl for the content source. Click on “Content sources” from left navigation. Click on the drop down option for the content source and select “Start Full Crawl”

start full crawl content sources search in sharepoint server 2019

follow the vide below, to know step by step procedure in video format for better understanding.

Advertisements
Advertisements
Advertisements

sharepoint service instance start stop stuck

How to manage sharepoint service instance using powershell ? You can manage service instance in like starting service instance, stopping service instance. If sharepoint service stuck unprovisioning or provisioning, you have to use powershell to resolve the error. You can remove delete instance mostly search service instance by getting service instance id or using get-spserviceinstance by name powershell command. Status of serivice instance will change to disabled or online after running powershell. you can unprovision duplicate service instances by identifying instance id using powershell.

Advertisements

Run below powershell command to get all services instances

Get-SPServiceInstance | Sort TypeName
sharepoint service instance id
Advertisements

powershell command to get a specific service instance below

Get-SPServiceInstance -Identity 431394e7-df13-4784-af78-719789210fdc # GUID of User Profile Service
Advertisements

start specific service instance powershell command as below

Start-SPServiceInstance -Identity 431394e7-df13-4784-af78-719789210fdc # GUID of User Profile Service
Advertisements

stop instance in sharepoint using powershell command mentioned below

Stop-SPServiceInstance -Identity 431394e7-df13-4784-af78-719789210fdc # GUID of User Profile Service
Advertisements

provision/start – service instance

you can provision or start service instance running any one of the powershell command mentioned below

Get-SPServiceInstance | Where-Object {$_.TypeName -eq "User Profile Service"} | select Status, Id

Get-SPServiceInstance | Where-Object {$_.Id -eq "431394e7-df13-4784-af78-719789210fdc"} # GUID of User Profile Service

Get-SPServiceInstance | where {$_.Status -eq "online" -and $_.TypeName -eq "User Profile Service" } | Sort TypeName | Format-Table TypeName,Id,Server
Advertisements

unprovision/stop – service instance

you can unprovision or stop sevice instance using any one of the commands below

$srvc = Get-SPServiceInstance “431394e7-df13-4784-af78-719789210fdc” # GUID of User Profile Service
$srvc.Unprovision()

$srvc = Get-SPServiceInstance -Server WIN-56R9D2TBFOB | where-object {$_.TypeName -eq “User Profile Service”}
$srvc.Unprovision()

Get-SPServiceInstance | Where-Object {$_.Id -eq "431394e7-df13-4784-af78-719789210fdc"} | Stop-SPServiceInstance | Format-Table -AutoSize # GUID of User Profile Service

Get-SPServiceInstance -Server WIN-56R9D2TBFOB | where-object {$_.TypeName -eq “User Profile Service”} | Stop-SPServiceInstance -confirm:$false > $null

You can get more details related to service application in sharepoint from the link “Service Applications in SharePoint

Advertisements

Watch the video to get step by step, more in detail

Advertisements