IISRESET across SharePoint farm servers

Here is something I use when I want to perform an IISRESETacross an entire SharePoint farm. Its useful if you have a large SharePoint farm.
Oh – yea, this will take down your farm while the IISRESET is restarting the services, so its best to test this on a non production environment first. Ensure you have an outage/agreed maintenance window to perform this task on a production farm.

All you got to do is spin up PowerShell on any SharePoint server in the farm and run this:

Write-Host -ForegroundColor Blue “IIS will  be reset across the entire farm”
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
[array]$servers= Get-SPServer | ? {$_.Role -eq “Application”}
$farm = Get-SPFarm
foreach ($server in $servers)
{
     Write-Host -ForegroundColor Yellow “Attempting to reset IIS for $server”
        iisreset $server /noforce “\\”$_.Address
        iisreset $server /status “\\”$_.Address
        Write-Host
        Write-Host -ForegroundColor Green “IIS has been reset for $server”
        Write-Host
}
Write-Host -ForegroundColor Green “IIS has been reset across the SharePoint Farm”
Start-Sleep -Seconds 5
Write-host

 

Reference: http://wellytonian.com/2012/04/iis-reset-your-whole-sharepoint-farm/

Leave a Reply

Your email address will not be published. Required fields are marked *