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.
- Launch SharePoint 2010 Management Shell on any one of your SharePoint servers.
- In order to enumerate all existing application pools that were created for existing and existed service application, run Get-SPServiceApplicationPool as shown below.
- 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!
awesome post Hong, thanks so much, it helped me get rid of my orphan app pools.
ReplyDeleteHow do I get the full name of the application pool where it's truncated such as for the Managed Metadata Service in your example
ReplyDeleteYou can use the following commands to get the full names:
ReplyDeleteGet-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!