Compartir a través de


Move a Web Application to a new Application Pool

A colleague sent me a great question today:

"Instead of consolidating application pools, how do I split up an application pool with too many web applications?"

The answer is actually to modify the application pool properties of the Web Application; NOT create a new application pool and set the Web Application Property. Here's the code:

 

 $webApp = Get-SPWebApplication https://sp2013.lab.local
                
 $newWebAppPWD = ConvertTo-SecureString "Password"
 $webApp.ApplicationPool.Username = "lab\AppPoolSvcAcct"
 $webApp.ApplicationPool.Name = "New App Pool Name"
 $webApp.ApplicationPool.SetPassword($webWebAppPWD)
 $webApp.Provision()

 

To check your work:

 $appPools = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools
 $appPools