Wednesday, October 27, 2010

Remove unnecessary or orphaned Service Application Pool for SharePoint 2010 Service Application


If you have created and deleted several service applications in SharePoint 2010, you will see that deleting the service application doesn't automatically delete an application pool associated with the service application. If you do not plan to re-use the application pool, here is how to get rid of such unnecessary/orphaned application pool using PowerShell.

  1. Launch SharePoint 2010 Management Shell on any one of your SharePoint servers.
  2. In order to enumerate all existing application pools that were created for existing and existed service application, run Get-SPServiceApplicationPool as shown below.
  3. As shown in the picture, I have 3 application pools for Managed Metadata Service and to delete 2 unnecessary application pools, I need to run Remove-SPServiceApplicationPool command as shown below.

One thing to keep in mind here when you run Remove-SPServiceApplicationPool command is that -Identity parameter is not any GUID or ID for the specific service application or application pool, but it's rather the application pool name that can be obtained by running Get-SPServiceApplicationPool. This will help you maintain your SharePoint environment cleaner. Good luck!
    

3 comments:

  1. awesome post Hong, thanks so much, it helped me get rid of my orphan app pools.

    ReplyDelete
  2. How do I get the full name of the application pool where it's truncated such as for the Managed Metadata Service in your example

    ReplyDelete
  3. You can use the following commands to get the full names:
    Get-SPServiceApplication | format-wide
    or
    Get-SPServiceApplication | format-list

    You may want to output to a file if you have many service applications:
    Get-SPServiceApplication | format-list >> D:\output.txt

    Hope this helps!

    ReplyDelete