ps/Modules/Alkami.PowerShell.IIS/Public/Set-AllAppPoolDefaults.ps1
2023-05-30 22:51:22 -07:00

24 lines
712 B
PowerShell

function Set-AllAppPoolDefaults {
<#
.SYNOPSIS
Sets all Application Pools to the Alkami Defaults
#>
[CmdletBinding()]
Param()
$logLead = (Get-LogLeadName)
$appPoolsToCheck = (Get-ChildItem IIS:\AppPools\).Where({$_.Name -notlike ".NET *" -and $_.ManagedRuntimeVersion -eq "v4.0"})
Write-Verbose ("$logLead : Found {0} application pools to check" -f $appPoolsToCheck.Count)
foreach ($appPool in $appPoolsToCheck) {
(Set-AlkamiWebAppPoolConfiguration $appPool.Name)
}
$sites = (Get-ChildItem IIS:\Sites\)
foreach ($site in $sites) {
(Set-ItemProperty "IIS:\Sites\$($site.Name)" -Name applicationDefaults.preloadEnabled -Value $true) | Out-Null
}
}