Assigning an Application Pool to a SharePoint Web App

60

the easy/obvious way is the wrong way. The trick is to reassign the app pool to the web app so SharePoint know about it. That way on a reconfig, things don’t get configured incorrectly.

To do it correctly, we’ll leverage this PowerShell snippet:

$sourceWebAppPool = (Get-SPWebApplication < URL of an existing webapp  application pool you want to use >).ApplicationPool
$webApp = Get-SPWebApplication < URL of the web application you want to update >;
$webApp.ApplicationPool = $sourceWebAppPool
$webApp.ProvisionGlobally()
$webApp.Update()
iisreset

if you do not have a web application already using the desired web application pool, you have the option to create a new application pool to use:

Import-Module WebAdministration
$appPool = New-WebAppPool "My new App Pool"

However, while I initially could not find a CmdLet for doing a “get-webAppPool”, my friend Brett Parker suggested:

$appPool = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools | Where {$_.Name -eq "NameOfAppPool" }

Share this entry

Leave a Reply

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

Table of Contents

Categories

Categories