SharePoint provides an option in Create New WebApplication page that says Restart IIS Automatically. This restarts IIS on all servers of the farm.

What can I do to trigger this programmatically from my Application Page (ASP.NET)?

Is there a timer job for this? Is there anything in the API? do I have to create "iisreset" process and pass it the name of servers?


When you create a new web application a timer job is created to run seperatly on ALL servers, this timer job will perform the IISReset - It uses remoting to call into IIS - http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcclientchannel.aspx - however I find these kind of tasks easier using WMI.

If you wanted to replicate this exact functionality then a timer job that is set to run on all servers independantly will be sufficient, my first port of call would be to take a look at the SPWebApplicationProvisioningJobDefinition using Reflector, this will show you exactly how they do it :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.