如何使用 PowerShell 在 SharePoint 中创建服务应用程序池?
服务应用程序池在 IIS 内运行服务应用程序代理 Web 服务。通常,所有服务应用程序都可以使用同一应用程序池运行。您可以在 SharePoint 2013 中创建新的服务应用程序时创建新的服务应用程序池。
是否曾想使用 PowerShell 在 SharePoint 中创建新的服务应用程序池?好吧,这是我的 PowerShell 脚本,用于创建新的 AppPool。
先决条件:我们需要一个托管帐户(或服务帐户的登录凭据)来创建服务应用程序池。
用于在 SharePoint 2013 中创建新服务应用程序池的 PowerShell 脚本:
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
}
