I recently encountered an interesting situation while testing Service Applications. If you elect to create a new Application Pool during the creation of your Service Application, SharePoint will create the defined App Pool on your behalf. Something interesting happens however, when you delete that Service Application. The App Pool does not get deleted! As you might expect, this is not very “clean” from a maintenance perspective and can potentially cause other problems down the road. Therefore, I would encourage you to keep the list of App Pools clean by removing any that may be orphaned.
Find the Orphaned App Pool
The first step in this process is to find the orphaned App Pool and its name. This can easily be accomplished by executing Get-SPServiceApplicationPool | select Id, Name from the SharePoint 2010 Management Shell. Identify the orphaned App Pool by either Name or Id.
Increase business process efficiency and collaboration with Microsoft SharePoint
Remove the Orphaned App Pool
Once you have identified the Name of the orphaned App Pool, you can easily remove it by executing Remove-SPServiceApplicationPool -Identity “App Pool Name” in the open SharePoint 2010 Management Shell. Type Y when prompted to confirm the removal of the App Pool and complete the process. At this point, I like to re-execute the script to list the App Pools again to verify that it was removed successfully.
While this may seem straight-forward, it can be tricky at times to understand what SharePoint is doing behind the scenes. Here at Credera, we have lots of experience leveraging the power and complexity of SharePoint. If you have any questions about this post or anything else SharePoint related, we would love to hear from you.