Perform an IIS Reset on all your SP Servers via PowerShell


This script will list all your SP Servers and restarts IIS on all of them.

 

add-pssnapin microsoft.sharepoint.powershell
$spserver = get-spserver | ?{$_.role -eq "Application"}
foreach ($server in $spserver)
{
   write-host "Performing IIS Reset on Server:"$server.name
   iisreset $server.Name
}

 


Comments (4)
  1. John says:

    If you haven’t set up RPC this won’t work, however the SP install user is set up for remote PowerShell commands, so this will work as that user with no additional configuration:

    $spserver = get-spserver | ?{$_.role -eq “Application”}
    $spserver | % {Invoke-Command -ComputerName $_.Address {iisreset}}

  2. Thanks Thomas for your effort.

  3. TeFaAaZ says:

    awesome trick
    thanks

  4. Tushar says:

    Perfect.. Thank you so much for sharing… !!

Comments are closed.

Skip to main content