Monday, July 21, 2014

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.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!


You might also like:

Related Posts Plugin for WordPress, Blogger...