SharePoint Views

PowerShell script to perform IISRESET on all servers in SharePoint Farm

This is a handy PowerShell script to have for every SharePoint admin. I’m sure, most of you have already had something like this.

This script is used to Reset all the Servers in SharePoint farm one after other without logging into each and every server. This comes handy during maintenance or in your Development environment where you will be getting your hands dirty.


 

#IISRESET onĀ all servers in SharePoint Farm

[array]$servers= Get-SPServer | ? {$_.Role -eq “Application”}

foreach ($server in $servers)
{
Write-Host “Attempting to reset: $server”
iisreset $server /noforce “\\”$_.Address
Write-Host
Write-Host -ForegroundColor Green “IIS has been reset for $server”
Write-Host
}
Write-Host “Reset completed!”