Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## 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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement