0

i have a small application to configure IIS using Process.StartInfo. The application works fine in Windows 2008 R2 64-bit and all the 32-bit machines. I dont see much differensce even if i use Runas. The application is run as local admin on the box.

the code is below

namespace ConsoleApplication1 {

class Program
{
    private const string configIISParameters2012 = "/k START /w C:\\Windows\\SysNative\\PKGMGR.EXE /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;
    private const string exeCommand = "CMD.EXE";
    static void Main()
    {
        RunCommand(exeCommand, configIISParameters2012);          
    }

    public static bool RunCommand(String command, String arguments)
    {
        bool ret = false;
        try
        {

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.CreateNoWindow = true;
            startInfo.Verb = "unas";

            startInfo.FileName = command;
            startInfo.Arguments = arguments;
            process.StartInfo = startInfo;
            process.StartInfo.UseShellExecute = true;
            process.EnableRaisingEvents = true;

            process.Start();
            process.WaitForExit();

            process.Close();
            ret = true;
        }
        catch (Exception ex)
        {
            //Utility.Log("Exception executing command :" + ex.StackTrace);
        }
        return ret;
    }
  • Anything in the event viewer? I'd be willing to bet it is a security issue of some sort. – Allan Elder Apr 10 '14 at 19:10
  • UAC is turned off, that is the one i could think of. The OS is off the shelf installed. Nothing has been modified except for turning off UAC – user3334759 Apr 22 '14 at 07:37

0 Answers0