SharePoint 2010: Delete Service Application

Original Post: https://knowledge.zomers.eu/SharePoint/Pages/How-to-remove-a-SharePoint-2010-Service-Application.aspx

It may be necessary to remove one or more Service Applications in SharePoint 2010. It has happened to me quite a few times alread that the Search Service Application got corrupt and needed to be recreated. Unfortunately often this isn't as easy as using the standard delete function in the ribbon. Luckily there are other ways to get it done.

First method - The official way

  1. Open up Central Administration
  2. Click on the link Manage service applications under Application Management

    SP2010RemoveServiceAppCentralAdminLink.png
  3. Click the row with the Service Application you wish to delete so it will be marked in blue. Click on the Delete button in the ribbon to initiate the deletion process. Allow a couple of minutes for it to complete. If it doesn't seem to complete after waiting at most 15 minutes, proceed with method 2 below.

    SP2010RemoveServiceAppDeleteLink.png

Second method - The PowerShell backdoor

  1. If the first method does not work, you can try it using a direct PowerShell command. Open up a PowerShell window on your SharePoint 2010 server.
  2. Type the following line to enable the SharePoint PowerShell AddIn for the current window:

    Add-PSSnapin Microsoft.SharePoint.PowerShell

    SP2010RemoveServiceAppAddPSSnapin.png

  3. Type the following command to list all the Service Applications available on your farm. Look for the one being the Service Application you want to delete and copy its value in the Id column:

    Get-SPServiceApplication

    SP2010RemoveServiceAppGetSPServiceAppId.png
  4. Type the following command to remove the Service Application. Provide the Id retrieved at the previous step behind the Identity parameter:

    Remove-SPServiceApplication -Identity <id>

    SP2010RemoveServiceAppCommand.png
    If this also takes a long time (allow it at most 15 minutes to complete), proceed with method 3 below.

Third method - The dirty way

If the two options above fail, there is stil the dirty way of forcing removal:

  1. Follow steps 1 to 3 from method 2 to retrieve the Id of the Service Application you wish to remove, if you haven't got this Id yet.
  2. Enter the following command to instruct removal of the Service Application. Replace <id> with the Id retrieved at the previous step:

    stsadm -o deleteconfigurationobject -id <id>

    SP2010RemoveServiceAppStsadmCommand.png

    Allow a couple of minutes for this to complete. If also this method seems to be stuck, leave the process running, open up services.msc via the Windows start menu and restart the SharePoint 2010 Timer Windows service. That should get the command to complete after which the Service Application should be gone.

    SP2010RemoveServiceAppTimerService.png
  3.  
Thanks and I hope this helps someone else too.