public void Execute(IExecutionContext engineContext) { // do it if (Local) engineContext.LogProvider.Log(LogType.Log, engineContext.TaskName, "Performing iisreset on local computer"); else engineContext.LogProvider.Log(LogType.Log, engineContext.TaskName, "Performing iisreset on " + RemoteComputer); // do it ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "iisreset.exe"; psi.UseShellExecute = true; psi.CreateNoWindow = true; psi.WindowStyle = ProcessWindowStyle.Hidden; // specify args? StringBuilder sb = new StringBuilder(); switch (Action) { case IisResetAction.Restart: // no special args break; case IisResetAction.Start: sb.Append("/START "); break; case IisResetAction.Stop: sb.Append("/STOP "); break; } // remote? if (!Local) sb.Append(RemoteComputer); // run it Process p = Process.Start(psi); p.WaitForExit(); // done engineContext.LogProvider.Log(LogType.Log, engineContext.TaskName, "Finished iisreset"); } public void Prefetch(IExecutionContext engineContext) { }