How to run IISWeb.vbs command in an asp.net application
<p>Can somebody please help me in executing the IISWeb.vbs commands from the c# code which I am trying to use for starting and stopping the websites on remote IIS servers (IIS 6.0).</p>

<p>I have tried other options like using DirectorServises with SyytemManagement or with WMI but in all cases code works fine for the local IIS server but displays error for the remote servers. I get 'Access denied' error for remote servers</p>

<p>I have got the all the servers in the same domian and network area and trying with a user account with administrative priviledge but nothing works for remote machine so giving it a try using IISWeb.vbs.</p>

<p>Please note that from my dev machine I am able to stop and start the websites on remote machines using this IISWeb.vbs commands without any problem when I run it from command prompt. So definitely there is no permission issues.
Code I am using:</p>

<pre><code>        Process p = new Process();
        p.StartInfo.FileName = "cscript.exe";
        p.StartInfo.Arguments = "iisweb.vbs /stop w3svc/87257621 test /s servername /u userid /p password";
        p.StartInfo.UseShellExecute = false;
        p.Start();
        p.WaitForExit();
        int i= p.ExitCode;
</code></pre>

<p>Surprisingly I am not getting any error and i get return code '0' but nothing but website is not getting stopped.</p>

<p>Please help me out.</p>
