Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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 :)

Stuart

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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