You can use the following PowerShell code to create a new Application Pool for your SharePoint site
$svc = [Microsoft.SharePoint.Administration.SpWebService]::ContentService
$pool = New-Object Microsoft.SharePoint.Administration.SPApplicationPool "SharePoint App Pool", $svc
$pool.CurrentIdentityType = "SpecificUser"
$acct = Get-SPmanagedAccount DOMAIN\USER
$processAcct = [Microsoft.SharePoint.Administration.SPProcessAccount]::LookupManagedAccount($acct.Sid)
$pool.ProcessAccount = $processAcct
$pool.Provision()
The application pool will be created.
You can update an existing application’s application pool followed by this script:
$webApp = Get-SPWebApplication http://web
$webApp.ApplicationPool = $pool
$webApp.ProvisionGlobally()
$webApp.Update()
You can also switch a web application’s application pool to another by using the following PowerShell Script
$sourceWebAppPool = (Get-SPWebApplication http://web1).ApplicationPool
$webApp = Get-SPWebApplication http://web2
$webApp.ApplicationPool = $sourceWebAppPool
$webApp.ProvisionGlobally()
$webApp.Update()