kwizcom banner advertisement

Restart IIS (IISRESET) on All Servers in the SharePoint Farm using PowerShell

Doing IISReset on Server Farm with Multiple SharePoint servers is a painful processes. If you ever need to restart IIS on all servers in the SharePoint farm, Here is a nifty solution to do IISRESET on all SharePoint Servers using PowerShell:

PowerShell Script to Restart IIS on All SharePoint Servers:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#Get All SharePoint Servers - Except DB and SMTP Servers
$Servers = Get-SPServer | Where {$_.Role -ne "Invalid" }

    #Iterate through the list and restart one by one.
    foreach ($server in $servers)  
    {  
       Write-Host "Restarting IIS on server: $($Server.Name)"
       IISRESET $Server.Address
    
       #Optional: Get the Status
       Write-Host "IIS status for server $($server):"  
       IISRESET $server.Address /status
    } 
Write-host "IIS Restarted on All Servers of the Farm!" -f Green
Make sure, you have "Local Administrator" Permission on all servers you want to reset IIS.
Restart IIS (IISRESET) on All Servers in the SharePoint Farm using PowerShell Restart IIS (IISRESET) on All Servers in the SharePoint Farm using PowerShell Reviewed by Salaudeen Rajack on 6:04 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.