Reset IIS on all servers in a farm

How many times have you been in the middle of a series of updates to your farm, or at the end of an update, or maybe trying to resolve an issue with the magic of IIS reset and felt the pain of:

  • Logging into each server
  • Opening a command prompt
  • Typing IISRESET /noforce
  • and then wait, make sure all are done, etc.

We’ll no longer shall you have to do that miserable task of logging in etc. And let the record show, this is not a new script, I didn’t even write it, it’s probably out there on other blogs, I got this from a fellow SharePoint guru.

Here’s how you use it:

Create a powershell script

  •  copy the above into a text file and rename the file with a .ps1 extension

Run the powershell script

  • open the SharePoint Management shell, navigate to wherever you saved the .ps1 file, and type “.\filename.ps1” where filename is the name you used, and omit the quotes.

If you’re running it for a SharePoint 2016 farm, you’ll want to modify line 16, else it will only reset the app server.

Cheers and Happy SharePointing!!!

Leave a Reply