One of my current projects involves building a farm with Multiple SharePoint servers. One of the painful processes is doing an IISReset across the farm. There are few solutions out there and this is the one I wrote couple of days back using their logic.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cls
Write-Host "Loading SharePoint Commandlets"
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Write-Host -ForegroundColor Green " Commandlets Loaded ... Loading Variables"
Write-Host
[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

Peace!