Search Service Application on server is not provisioned

Platform: SharePoint Server on prem 2016

Background: I had a customer report that the search was not indexing items. Another hosting provider has installed the SharePoint server, which is a single server farm (1 SP server and 1 SQL server).

Error message: the below error message is shown in the Search Service Application:

The search application ‘Search Service Application’ on server XXX is not provisioned. Confirm that the Microsoft SharePoint Foundation Timer service and Central Administration service are running on the server.

When clicking on ”Content sources” this error message was displayed:

The search service is currently offline. Visit the Services on Server page in SharePoint Central Administration to verify whether the service is enabled. This might also be because an indexer move is in progress.

The search application pools was run with the farm accounts, which is never a good idea! I asked them to create a specific Search crawler account, (you can use one for the service and another for the application pools). First I tried to change the accounts on the application pools to see if that would solve this issue. To do that, you must first register the new search account in ”Managed accounts” under ”Security” in Central Administration:

Then open the properties of the search service applications, create a new application pool and change to the proper search accounts:

Search is provisioned again:

Then I restarted the search on Services on server, and noticed this message when restarting the SharePoint Server Search:

Invalid search service unprovisioning: application ‘Search Service Application’ still has a ready component ‘in search service instance’ on server ‘xxx’.

I realised that I had to rebuild the search application because the actions above was not enough. And that is something I have learned, working with this type of errors for many years, that it will be a faster process to start over than to spend hours troubleshooting! Here are the steps to remove the search service application using PowerShell (SharePoint 2016 Management Shell).

Delete the Search Service Application

Start up an elevated (this is important as you will not be able to perform some of the steps unless you run the PS windows as Admin) PowerShell window and run the command Get-SPEnterpriseSearchServiceApplication :

Note the ID’s and then run another command using the id of the index component as it will be used in the next cmdlet where you will then see the location of the index root directory so that it can be removed if needed.

$ssa=Get-SPEnterpriseSearchServiceApplication
$ssai1=Get-SPEnterpriseSearchComponent -SearchTopology [TopologyID] -SearchApplication $ssa -Identity [ID of first index component]
$ssai1

Then delete the Search Service Application and its proxy by this cmdlets:

$spapp = Get-SPServiceApplication -identity [theIDofyoursearchapp]

Remove-SPServiceApplication $spapp -RemoveData

Check that the proxy is also removed, and if its not then run this cmdlet to delete it:
Get-SPServiceApplicationProxy | sort-object TypeName | ft TypeName,ID -auto
Remove-SPServiceApplicationProxy [ID]

Delete any Search Service Application Pools:
Get-SPServiceApplicationPool | ft Name, ID -auto
$SPAppPool = Get-SPServiceApplicationPool “[App Pool Name]”
Remove-SPServiceApplicationPool $SPAppPool

Now all search related apps and data should be removed from the farm. I rebooted the server at this stage, it might not be necessary – it’s my OCD 🙂

Create a new Search Service Application

Just a note: This farm is not a large one, obviously, and less than 10000 items in index so I expected the rebuild of index to be quite fast. Think about how large the farm is when planning work tasks like this, if you have a large index you might need a weekend to work and rebuild as it also affects the server performance while crawling.

I created the new Search app in Central Administration instead of using PowerShell. I created new application pools and set the new search crawl accounts on them:

A new provision in progress followed by a Success message.

Went into my new search application and now the start page was back to normal! Success indeed!

Also wait a bit to make sure that the components are loaded correctly. They are found a bit down on the start page, and they should all turn green. They load after hand so don’t worry if you see a warning triangle or similar, just give it a few minutes and it will hopefully turn green.

You must wait for this because the Content Sources are provisioned in this also. (Otherwise there will be no content sources when you click on that link). When the components are all up and running, click on Content sources and find that a “Local SharePoint sites” is added with your site collections in it:

Now start a Full Crawl (this will take time depending on how large search index and items you got in the farm). For me this took 30 minutes and it went from 3000 to 7000 when it was done (it was stuck on 3000 since the error had occurred). So now everything was working again!

The last thing I did was to add a scheduled full crawl that will take place once a week in this farm. Otherwise it will run Continuous.

Done!

Share this blog post:

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of