SharePoint 2010 Search Service Removal and Cleanup

By James|04/07/2020|, ,

Sometimes you just need to rebuild SharePoint 2010 search.  It happens.  Life happens.  SharePoint 2010 Search poops the bed.  This article will discuss how to remove a SharePoint 2010 search service application and clean up leftover search components.

Search Service Application Removal

So the first thing we need to do is remove the search service application.  This can be done using Central Administration or PowerShell.

Remove With Central Administration

To remove the search service application using Central Administration:

  • Launch Central Administration
  • Navigate to Application Management > Manage Service Applications
  • Click on the search service application so that it's highlighted.  Do not click on the name of the search service application, as that will take you to search administration.
  • Click the delete button in the top menu ribbon
  • A "Delete Service Application" warning will be displayed.  If you want to keep your search databases, make sure the "Delete data associated with the Service Application" check box is clear.
  • Click OK

Remove With PowerShell

To remove the search service application using PowerShell:

$ssa = Get-SPServiceApplication -Name "Your Search Service Application Name"
Remove-SPServiceApplication $ssa - RemoveData

Die Search Die

Sometimes neither of the above methods work and result in timeout and/or error(s).  In this case, the following PowerShell can be used as a final resort:

# Method One
Get-SPEnterpriseSearchServiceApplication
# Take note of the search service application GUID
$ssa = Get-SPEnterpriseSearchServiceApplication -id "<search_guid>"
$ssa.unprovision(1)

# Method Two - In Case Method One Fails
Get-SPEnterpriseSearchServiceApplication
# Take note of the search service application GUID
$ssa = Get-SPEnterpriseSearchServiceApplication -id "<search_guid>"
$ssa.delete()

Stopping Search Components

Once the search service application has been removed, there may be leftover components running the search server(s).

SharePoint Server Search

To ensure this service has stopped on all farm servers:

  • Launch Central Administration
  • Navigate to System Settings > Manage Services On Server
  • Look at each farm server by clicking the server drop down, select "Change Server" then select a different server from the pop-up window
  • If "SharePoint Server Search" is running, it can be stopped by executing the following PowerShell code on the affected server
Get-SPEnterpriseSearchServiceInstance -Local | Stop-SPEnterpriseSearchServiceInstance
  • Alternately, to ensure "SharePoint Server Search" is not running on ANY farm server, execute the following PowerShell code from any farm server
Get-SPEnterpriseSearchServiceInstance | Stop-SPEnterpriseSearchServiceInstance

Search Query and Site Settings Service

To ensure this service has stopped on all farm servers:

  • Launch Central Administration
  • Navigate to System Settings > Manage Services On Server
  • Look at each farm server by clicking the server drop down, select "Change Server" then select a different server from the pop-up window
  • If the "Search Query and Site Settings Service" is running, click the "Stop" action for the service

Search Administration Web Service

To ensure this service has stopped on all farm servers:

  • Launch Central Administration
  • Navigate to System Settings > Manage Services On Server
  • Change the view drop down from Configurable to All
  • Look at each farm server by clicking the server drop down, select "Change Server" then select a different server from the pop-up window
  • If the "Search Administration Web Service" is running, it can be stopped by executing the following PowerShell code
$srv = Get-SPServer -Identity <SEARCH_ADMIN_SERVER>
$si = $srv.ServiceInstances | Where {$_.TypeName -eq "Search Administration Web Service"}
Stop-SPServiceInstance $si

 

Copyright 2011 - 2024 The Lazy IT Admin | All Rights Reserved
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram