Introduction
This posting integrates postings and comments by Brendan Griffin and Henrik Tønnessen and consolidates my notes on this topic. It assumes that the account you will be using for the new web application pool identity is a managed account.
Add a new web application pool and assign to web application
This posting integrates postings and comments by Brendan Griffin and Henrik Tønnessen and consolidates my notes on this topic. It assumes that the account you will be using for the new web application pool identity is a managed account.
Add a new web application pool and assign to web application
- Review
- Log into a SharePoint 2013 server using the SharePoint Setup User Administrator account (eg, spAdmin). This is the same account that you (should have) used to perform the initial farm installation and configuration.
This is important in that the changes you will be making will be to the farm configuration database; and, by default, only this account has the privileges necessary to make such changes.
- Launch an elevated SharePoint Management shell.
- Execute the following commands, making appropriate revisions:
([Microsoft.SharePoint.Administration.SPWebService]::ContentService).ApplicationPools | Sort-Object Name | Select-Object Name, ID, UserName, Status, parent | Format-Table -Auto
- Create
- Now, using the same management shell, execute the next few commands to create the new pool:
The new application pool will be available immediately.$WebAppURL = "[Your site URL]" $NewAppPoolName = "[NameOfNewAppPool]" $NewAppPoolIdentity = "[IdentityOfnewAppPool]" $Password = Read-Host -Prompt "Enter the service account password: " -AsSecureString $Service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService $NewAppPool = New-Object Microsoft.SharePoint.Administration.SPApplicationPool($NewAppPoolName,$Service) $NewAppPool.CurrentIdentityType = "SpecificUser" $NewAppPool.Username = $NewAppPoolUserName $NewAppPool.SetPassword($Password) $NewAppPool.Provision() $NewAppPool.Update($true) $NewAppPool.Deploy() - Verify
- Log into one of the farm WFEs hosting the web application using any administrator account.
- Launch IIS Manager.
- In the Connections tree, expand Application Pools.
- Review
- Log into a SharePoint 2013 server using the SharePoint Setup User Administrator account (eg, spAdmin). This is the same account that you (should have) used to perform the initial farm installation and configuration.
This is important in that the changes you will be making will be to the farm configuration database; and, by default, only this account has the privileges necessary to make such changes.
- Launch an elevated SharePoint Management shell.
- Execute the following commands, making appropriate revisions:
([Microsoft.SharePoint.Administration.SPWebService]::ContentService).ApplicationPools | Sort-Object Name | Select-Object Name, ID, UserName, Status, parent | Format-Table -Auto
- Identity the name of the web application pool you want to remove.
- Copy this name.
- Remove
- Now, using the same management shell, execute the following command to remove the web application pool.
This executes as a job and will take a minute or two to complete.$apppool = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools | where {$_.Name -eq "[name of web application pool]"} $apppool.UnProvisionGlobally() - Verify
- Log into one of the farm WFEs hosting the web application using any administrator account.
- Launch IIS Manager.
- In the Connections tree, expand Application Pools.
References
- Direct
- Initial deployment administrative and service accounts in SharePoint 2013
- Account permissions and security settings in SharePoint 2013
- SharePoint 2013: Service Account Configurations and Permissions
- Create a SharePoint Application Pool using PowerShell
- Delete a SharePoint Web Application Pool
- Title Application pools recycle when memory limits are exceeded. ???
- General
Notes
- The new web application pool will not be added to the application pools associated with web applications until you execute the Update method. You can test this by executing all of the commands up to but not including the Update method, and then listing out the web application pools. Additionally, you will not see the new application pool show up in IIS Manager until after you execute the Deploy method.
- The Remove method of [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools object appears to only remove the web application pool from the farm configuration database and not also from IIS. On the other hand, the UnprovisionGlobally method of an SPApplicationPools object removes the application pool both from SharePoint and IIS.
- If you get an instance of the SPApplicationPools object and review its members, note that there is a Provision method but that this method does not push the update to the WFEs. On the other hand, the UnprovisionGlobally method of this object does touch both SharePoint configuration and IIS, updating both. This seems inconsistent.
- Thanks to Brendan Griffin and Henrik Tønnessen for helpful presentations on this topic.