Friday, June 14, 2013

SharePoint 2013/2016: Listing out Existing SharePoint App Pools

The SharePoint App Pools that run your web applications exist in SharePoint whether or not they physically exist in IIS. I previously looked at consolidating some of these app pools to reduce the worker processes and memory consumption. I used this post as a guide.

However, my manager decided that he wanted all of the web apps to go back to using their own app pool. You can't just go and create a new app pool in IIS and assign it to your web app (technically you can but that's wrong).

I found a post here that creates a function for setting the app pool. You must know the name of the SharePoint App Pool. Since I previously deleted mine I used a reference in that function to list out the available SharePoint app pools:

[Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools | ft Name

You may use any of the existing names when calling the function in Ivan Josipovic's post.

Notice, however, the Central Admin app pool is not listed. The app pools listed are all for the content-based web applications. To get the administrative app pools, use this command:

[Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.ApplicationPools | ft Name

I therefore created a new function to handle my Central Administration app pool change:

Function Set-WebCAApplicationPool($WebAppURL,$ApplicationPoolName){
    $apppool = [Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.ApplicationPools | where {$_.Name -eq $ApplicationPoolName}
    if ($apppool -eq $null){
        write-host -foreground red "The Application Pool $ApplicationPoolName does not exist!"
        return 1
    $webapp = get-spwebapplication -Identity $WebAppUrl
    if ($webapp -eq $null){
        write-host -foreground red "The Web Application $WebAppUrl does not exist!"
        return 1
    $webapp.Applicationpool = $apppool
    write-host -foreground green "$WebappURL Application Pool has been changed to $ApplicationPoolName"
    return 0

Set-WebCAApplicationPool -WebAppURL "http://SP2013SVR:12345" -ApplicationPoolName "SharePoint Central Administration v4"

Obtaining Service Application App Pools is much easier as there is a SharePoint PowerShell cmdlet for this:

Get-SPServiceApplicationPool | ft name

These are the Service Application Application Pools that are running on the entire farm - regardless of the server. I consolidated several Service Applications to use the SharePoint Web Services System pool if the services run on the same application server.


  1. Hi, i'm setting up my farm using powershell and i'm getting different app pools for each service, i can identify them also by looking at the service account that it runs under. is it best practice to use different app pools for each service or run them under the same app pool?

    1. To save on resources I would try to consolidate the app pools. On some service applications, it is recommended to have a separate app pool (Secure Store Service for example). Todd Klindt posted a top 10 mistakes article previously for SharePoint 20102013 and one if them was running all service apps in separate app pools.


Matched Content