How can I force delete SharePoint 2013 search service?
I installed Search service using PowerShell.  It failed. I tried to remove the service and only partially removed. Now when i try to remove it again it says I cannot login to the search database - the search database no longer exists.  Is there a way to force delete the service?
July 17th, 2013 7:59am

You may have a stale database try:

Get-SPDatabase | where {$_.name -like "*Search*"}

The above will get you all of your search databases, get the GUID of the database you want to delete:

PS C:\> $db = Get-SPDatabase | where {$_.ID -eq "GUID"}
PS C:\> $db.Delete()

Free Windows Admin Tool Kit Click here and download it now
July 17th, 2013 8:30am

Thanks ThatGuyRyan. Unfortunately the DBs no longer exist. Trying to remove the service with no DB's.
July 17th, 2013 9:12am

Hi,

Have you tried to remove the Search Service from Centeral Administration page?

Free Windows Admin Tool Kit Click here and download it now
July 17th, 2013 9:25am

I have tried to remove through CA. And it throws an error (not at machine to take screen shot). The error is essentially saying "the account contoso\sp.admin is unable to login to the database SP2013_SearchService" and they refuses to remove service.

It can't login because it no longer exists.

July 17th, 2013 9:34am

If you run get-spserviceapplication does it show up?  You can follow the same steps I outlined for the database to force delete the service app
Free Windows Admin Tool Kit Click here and download it now
July 17th, 2013 9:54am

Have you tried to remove it using Powershell?

Verify that you meet the following minimum requirements:

  • You must have membership in the securityadmin fixed server role on the SQL Server instance

  • You must have membership in the db_owner fixed database role on all databases that are to be updated.

  • You must be a member of the Administrators group on the server on which you are running the Windows PowerShell cmdlet.

$spapp = Get-SPServiceApplication -Name "<Service application display name>"
Remove-SPServiceApplication $spapp
Remove-SPServiceApplication $spapp -RemoveData

The last line removes the databases!

July 17th, 2013 10:09am

When I run Get-SPServiceApplication

Enterprise Search service is listed.

When I run 

Get-SPServiceApplication | ?{$_.TypeName -like "*search*"}

I get:

format-default : Exception has been thrown by the target of an invocation.
    + CategoryInfo          : NotSpecified: (:) [format-default], TargetInvoca
   tionException
    + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Micr
   osoft.PowerShell.Commands.FormatDefaultCommand

So I can't get a handle on it to delete it.


Free Windows Admin Tool Kit Click here and download it now
July 17th, 2013 9:44pm

Hi again,

Have you tried to Clean the configuration cache and try again?

July 18th, 2013 3:08am

Dear,

did you already tried this:

$ssa = Get-SPEnterpriseSearchServiceApplication -id <GUID of your Search>
$ssa.unprovision(1)

and if this doesn't work you can replace the last line with

$ssa.Delete() 

Free Windows Admin Tool Kit Click here and download it now
July 18th, 2013 3:19am

Try and run configuration wizard and see if it can recreate or remove Search from your site!
July 18th, 2013 3:23am

Hi,

I have recreated your scenario and succeded to delete the search service application. Just follow the steps that I provided to you!

Get-SPServiceApplication

Identify the Guid of your search application

$P = Get-SPServiceApplication -identity PutYourSearchApplicationGuidHere

Remove-SPServiceApplication $p
Remove-SPServiceApplication $p -RemoveData

Free Windows Admin Tool Kit Click here and download it now
July 18th, 2013 5:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics