Last active
June 15, 2023 10:33
-
-
Save ankitvijay/9dd0aef6450a30d34516e0642d5e30b5 to your computer and use it in GitHub Desktop.
IIS Background Worker Setting
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
## IIS WebAdmin Module | |
Import-Module WebAdministration | |
$AppPoolInstance = Get-Item IIS:\AppPools\$AppPool | |
Write-Output "Set Site PreLoadEnabled to true" | |
Set-ItemProperty IIS:\Sites\$Site -name applicationDefaults.preloadEnabled -value True | |
Write-Output "Set Recycling.periodicRestart.time = 0" | |
$AppPoolInstance.Recycling.periodicRestart.time = [TimeSpan]::Parse("0"); | |
$AppPoolInstance | Set-Item | |
Write-Output "Set App Pool start up mode to AlwaysRunning" | |
$AppPoolInstance.startMode = "alwaysrunning" | |
Write-Output "Disable App Pool Idle Timeout" | |
$AppPoolInstance.processModel.idleTimeout = [TimeSpan]::FromMinutes(0) | |
$AppPoolInstance | Set-Item | |
if ($appPoolStatus -ne "Started") { | |
Write-Output "Starting App Pool" | |
Start-WebAppPool $AppPool | |
} else { | |
Write-Output "Restarting App Pool" | |
Restart-WebAppPool $AppPool | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment