How to Create a Service Application Pool in SharePoint using PowerShell?
Service Application pools run service application proxy web services inside IIS. Typically, all the service applications can be run with the same application pool. You can create a new service application pool while creating new service applications in SharePoint 2013.
Ever wanted to create a new service application pool in SharePoint using PowerShell? Well, Here is my PowerShell script to create a new AppPool.
Prerequisites: We need a managed account (or login credentials of a service account) to create a service App Pool.
PowerShell Script to Create New Service Application Pool in SharePoint 2013:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Configuration Parameters
$AppPoolAccount = "Crescent\SP16-SearchAppPool"
$AppPoolName = "Search Service Application App Pool"
#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
#Create a managed account, if it doesn't exist
if($AppPoolAccount -eq $null)
{
Write-Host "Please Enter the password for the Service Account..."
$AppPoolCredentials = Get-Credential $AppPoolAccount
#Create new managed account
$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}
#Check if the application pool exists already
Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
if ($AppPool -eq $null)
{
#Create new App Pool
Write-Host -ForegroundColor Green "Creating Application Pool"
$AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
}
Thank you..helped me alot..