Summary
The blog referenced in the resource section below does a great job at demonstrating how to create a new SharePoint Web Application Pool and associate it with the Web App using PowerShell. However, as mentioned in the blog the process is a little different for Service Applications. The following information is just a quick demonstration on how to create a new service application app pool, and re-associate the existing service app to the new pool, then delete the old pool.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# The following commands are available when working with SharePoint Service Application Pools. # New-SPServiceApplicationPool # Get-SPServiceApplicationPool # Set-SPServiceApplicationPool # Remove-SPServiceApplicationPool # Check to ensure Microsoft.SharePoint.PowerShell is loaded $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} if ($snapin -eq $null) { Write-Host "Loading SharePoint Powershell Snapin" Add-PSSnapin Microsoft.SharePoint.Powershell } #Get the Service App you are working with and store it in a variable. Get-SPServiceApplication | FL DisplayName #Pick which Service App you wish to modify from the list generated above #Add the display name to the {$_.Name -eq " "} below $spsvcapp = Get-SPServiceApplication | where {$_.Name -eq "BDC Service APP"} #run $spsvcapp alone to ensure you have bound to the correct application. $spsvcapp # Note: # For the next command, the "-account" used below should be Managed account in SharePoint. # Before to executing the script use "New-SPManagedAccount" if a new account will be created. # Example: # $cred = Get-Credential # New-SPManagedAccount -Credential $cred #Time to create to new App Pool $newpool = New-SPServiceApplicationPool -Name "New_BDC_AppPool" -Account "mylab\spservice" #Store the old App Pool in a variable. $oldapppool = $spsvcapp.ApplicationPool #Did it store properly? $oldapppool #Now associate the new app pool to the exiting service app. $spsvcapp.ApplicationPool = $newpool $spsvcapp.Update() #Removing the old App Pool if necessary. Remove-SPServiceApplicationPool $oldapppool |
Resources
Create a SharePoint Application Pool using PowerShell
https://blogs.technet.microsoft.com/fromthefield/2014/03/26/create-a-sharepoint-application-pool-using-powershell
New-SPManagedAccount
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/new-spmanagedaccount?view=sharepoint-ps
Get-SPServiceApplicationPool
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/get-spserviceapplicationpool?view=sharepoint-ps
New-SPServiceApplicationPool
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/new-spserviceapplicationpool?view=sharepoint-ps
Remove-SPServiceApplicationPool
https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/remove-spserviceapplicationpool?view=sharepoint-ps