Remove Unused Application Pools From SharePoint Environment

Piling up of unused application pools in the SharePoint environment is one of the common scenarios that occur in a SharePoint Server over time. One of such instances is: You create a Search Service Application and when the Service Application is deleted, the App Pools will still remain in the server. Retaining unused application pools are not advised as it consumes the server resources unnecessarily. So let us see how to remove unused Application Pools.

In order to do that spin up SharePoint Management Shell as Administrator.


Run the below command to get the list of all the Application Pools. 

  1. Get-SPServiceApplicationPool    


In my case there were 5(First 5 in the above image) application pools which were created as part of a failed Search Configuration. I had to remove them. We can remove the application pool by running the below command. 

  1. Remove-SPServiceApplicationPool -Identity "Application Pool Name" -Confirm:$false  

 So I ran it for all the 5 app pools I wanted to remove from the server. 

  1. Remove-SPServiceApplicationPool -Identity "AdminPool" -Confirm:$false  
  2. Remove-SPServiceApplicationPool -Identity "QueryPool" -Confirm:$false  
  3. Remove-SPServiceApplicationPool -Identity "Search Service" -Confirm:$false  
  4. Remove-SPServiceApplicationPool -Identity "Search Service Application" -Confirm:$false  
  5. Remove-SPServiceApplicationPool -Identity "Search Service Application1" -Confirm:$false  

 


In order to recheck the removal, run the Get-SPServiceApplicationPool’ command again. Thus we can see that the App Pools have been removed.


Summary

Thus we saw how to remove the unused application pools in SharePoint Server using PowerShell.

Ebook Download
View all
Learn
View all