IISFlush.ps1
While troubleshooting an error with Excel Web Access I found recycle wasn’t sufficient and IISRESET was needed. However, this raised questions about daily scheduled IIS recycle and if that would be enough to give a stable IIS footprint each business day. I decided to err on the side of caution and schedule a full IISRESET along with code to ensure all sites and pools started up again OK. PowerShell below.
Also, I would recommend installing SPBestWarmUp (http://spbestwarmup.codeplex.com) by running “spbestwarmup.ps1 –install” This creates a Scheduled Task repeating every 15 minutes to simulate user traffic and keep those IIS pools responsive for end users. No more wait on first visit. It even warms up Central Admin to help out SharePoint admins.
# Reset IIS and verify 100% started. Twice to be sure =)
Import-Module WebAdministration -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
function IISGo {
NET START W3SVC
Get-ChildItem IIS:\AppPools |% {Start-WebAppPool $_.Name}
Get-WebSite | Start-WebSite
}
IISRESET
Sleep 5
IISGo
Sleep 5
IISGo
