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.

create new service application pool 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
}

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

One thought on “How to Create a Service Application Pool in SharePoint using PowerShell?

  • Thank you..helped me alot..

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *