Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. ## IIS WebAdmin Module
  2. Import-Module WebAdministration
  3.  
  4. $AppPoolInstance = Get-Item IIS:\AppPools\$AppPool
  5.  
  6. Write-Output "Set Site PreLoadEnabled to true"
  7. Set-ItemProperty IIS:\Sites\$Site -name applicationDefaults.preloadEnabled -value True
  8.  
  9. Write-Output "Set Recycling.periodicRestart.time = 0"
  10. $AppPoolInstance.Recycling.periodicRestart.time = [TimeSpan]::Parse("0");
  11. $AppPoolInstance | Set-Item
  12.  
  13. Write-Output "Set App Pool start up mode to AlwaysRunning"
  14. $AppPoolInstance.startMode = "alwaysrunning"
  15.  
  16. Write-Output "Disable App Pool Idle Timeout"
  17. $AppPoolInstance.processModel.idleTimeout = [TimeSpan]::FromMinutes(0)
  18. $AppPoolInstance | Set-Item
  19.  
  20. if ($appPoolStatus -ne "Started") {
  21. Write-Output "Starting App Pool"
  22. Start-WebAppPool $AppPool
  23. } else {
  24. Write-Output "Restarting App Pool"
  25. Restart-WebAppPool $AppPool
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement