Created
January 3, 2015 16:48
PowerShell: Create a SharePoint Application Pool (http://blogs.technet.com/b/fromthefield/archive/2014/03/26/create-a-sharepoint-application-pool-using-powershell.aspx)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asnp *SharePoint* -ErrorAction SilentlyContinue | |
// URL of the Web App to change the Application Pool of. | |
$WebAppURL = "http://WebApp" | |
// name of the name Application Pool that will be created. | |
$NewAppPoolName = "NewAppPool" | |
//the user account that the Application Pool will run under the context of. | |
$NewAppPoolUserName = "contoso\apppool" | |
/* All done. Go time. */ | |
$Farm = Get-SPFarm | |
$Service = $Farm.Services | where {$_.TypeName -eq "Microsoft SharePoint Foundation Web Application"} | |
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString | |
$NewAppPool = New-Object Microsoft.SharePoint.Administration.SPApplicationPool($NewAppPoolName,$Service) | |
$NewAppPool.CurrentIdentityType = "SpecificUser" | |
$NewAppPool.Username = $NewAppPoolUserName | |
$NewAppPool.SetPassword($Password) | |
$NewAppPool.Provision() | |
$NewAppPool.Update($true) | |
$NewAppPool = $Service.ApplicationPools[$NewAppPoolName] | |
$WebApp = Get-SPWebApplication $WebAppURL | |
$WAAppPool = $WebApp.ApplicationPool = $NewAppPool | |
$WebApp.Update() | |
$WebApp.ProvisionGlobally() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment