Wednesday, September 17, 2008

SharePoint development VM loves IISReset

When we develop application pages or custom web part development in SharePoint. This requires a lot of IISreset for each and every bit of change in the assembly when we are going to deploy these modified binaries GAC.

IISRESET takes a lot of time instead of that if we recycle the required application pool which is associated to our IIS web application, this will save atleast a minute of dev effort.

This recycling process can be automated by using the following OOB VB script

cscript.exe iisapp.vbs /a SharePointAppPool /r

or
cscript.exe iisapp.vbs /p [Process ID] /r

[Process ID] : This can be obtained just by executing iisapp.vbs in the command line. This will list all the application pools with their process ids

Get more info about IISapp.vbs from Microsoft Technet library

Do you want to recycle all the application pools in your IIS ?

Save the following the VB script to vbs file and replace the MachineName with your Dev machine's name

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set Service = locator.connectserver("MachineName", "root/MicrosoftIISv2")
Set APCollection = Service.InstancesOf("IISApplicationPool")
For Each APInstance In APCollection
APInstance.Recycle
Next

No comments: