Thursday, April 12, 2012

Remove SharePoint Service Application Pool

I have been monkeying with the Search Service Application for the last couple days. From create new, to delete, and then re-create new one again in a different name... Then I noticed, when I delete the Service Application, it does not delete the Service Application Pool that previously created or associated with it.

So the previous entries are still in the Service App Pool, and the Service App Pool list is getting longer. when I check the IIS, all I see lots of GUID entries in the Service App Pool... I am nervous of removing GUID in the Service App Pool from IIS without knowing the App Pool Name of the GUID.

Then I turned my search to PowerShell and found a proper solution to remove the Service Application Pool...

First list all the Service Applications with the following cmdlet 
Get-SPServiceApplicationPool | Select Id, Name

* You will need the Service App Pool Name when you are moving the Service App Pool in PowerShell, and the ID, when you remove the Service App Pool from IIS Manager.

Second, remove the Service Application in PowerShell


Finally, find the ID in IIS Manager Application Pool, and remove the guid entry from there, if there application associate with the app pool, IIS will stop you from removing the entry.

That's it... 
Note : This is not a problem in SharePoint, because the App Pool can be shared by other applications as well, so removal process will require additional care and love...

1 comment:

  1. Hi.
    When I try to remove a pool by PS, it cannot be done due to something depend on it.
    But when I use Get-SPServiceApplication | ForEach-Object {$_.ApplicationPool.Name} , this pool is not listed. Is there any other thing which can use service application pool inside sharepoint?