Saturday, September 17, 2016

Manage IIS in SharePoint 2010 Using PowerShell Script

On your day-to-day activity as a SharePoint Administrator, you always need to monitor web sites, application pools in your SharePoint farm. Especially after the application deployments, I see there are many times, these websites and application pools got stopped in many servers and you need to login to each and every server and verify them and start them.

Here I have developed the below scripts where you do not need to login to each server, you just need to login to any one server in a farm and execute the below scripts which will remotely verify the websites, application pools and show you the results. There is also a possibility to start them if anything is stopped in any server in the farm.

Especially if you have a large SharePoint farm with multiple WFE servers, it will be very helpful to manage from one server. You do not need to login each server and manage them. You can save a lot of time!

Additionally there are two scripts to restart IIS and SharePoint services in the whole farm.  

Steps to follow:

Login to any server in Farm - > Copy the attached zip file and extract it -> Open SharePoint 2010 Management Shell -> Execute the below ps1 files.

Note: You will find Sam.Functions.ps1 file which contains below functions definitions.
  • Get all the Application Pools which are stopped in the SharePoint 2010 Farm
         .\Sam.GetAppPoolStatusOnFarm.ps1
  • Start the Application Pools which are stopped in the SharePoint 2010 Farm
         .\Sam.StartStoppedAppPoolOnFarm.ps1
  • Get all the web sites which are stopped in the SharePoint 2010 Farm
         .\Sam.GetWebsitesStatusOnFarm.Ps1
  • Start all the web sites which are stopped in the Farm(If Default web site is stopped in a server, then it will skip that server)
         .\Sam.StartStoppedWebSitesOnFarm.ps1
  • Restart IIS in all servers in the SharePoint 2010 farm
         .\Sam.RestartIISOnFarm.ps1
  • Restart SharePoint services in all servers in a SharePoint 2010 farm
         .\Sam.RestartSharePointServicesOnFarm.ps1

Note: For start/restart scripts, it will ask to you confirm(yes/no) in powershell window before it execute. So that you can take a decision before execute them.

Hope you like it!

Please find attached zip file containing all script files.

Please post your comment/feedback/questions.


No comments:

Post a Comment

Sam's SharePoint ULS Log Analyzer Tool

SharePoint ULS Log Analyzer Tool analyse ULS logs in a easy and simple way ! It has many more filters which helps SharePoint developers...