0

So I've looked at alot of different SO posts, I've been on codeproject and dreamincode aswell but I cant for the life of me find out how to CORRECTLY start a process on Windows 8.1 with admin rights. This is my code. I'm trying to create a silent install of FireFox but everytime I give it the filepath it still promts me with the UAC, and I thought that running as admin would work. What am I doing wrong here?

    Console.WriteLine("Please enter the path to the application: ");
    string path = Console.ReadLine();

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.UseShellExecute = true;
    psi.Verb = "runas";
    psi.Arguments = "/s /v /qn /min";
    psi.CreateNoWindow = true;
    psi.WindowStyle = ProcessWindowStyle.Hidden;
    psi.FileName = path;
    Process.Start(psi);
Jordan Jones
  • 125
  • 10
  • 1
    You can not bypass the UAC prompt. If it were trivial to bypass then every installer would do that. – vcsjones Sep 22 '17 at 12:24
  • Hm.. NiNite can.. https://ninite.com/ – Jordan Jones Sep 22 '17 at 12:25
  • 1
    Then the installer isn't installing anything to a location that requires elevating. If you install your program in to a user directory, you don't need to run as admin at all. If you install to a shared location, like Program Files, then elevation is required. – vcsjones Sep 22 '17 at 12:27
  • So, do you reckon a fix for this would be to install the files to a directory that doesnt require elevating? – Jordan Jones Sep 22 '17 at 12:29
  • We don't know what you're trying to do, we can only answer the question you asked, and you cannot circumvent the UAC. If you have a different question in mind, please ask it. – Lasse V. Karlsen Sep 22 '17 at 12:40
  • 1
    Sure. Many programs install that way. However that means the program will only be accessible to the user that did the installation. If there are other users on the PC, they'll have to install it themselves as well. It boils down to whether the installer is doing s System-wide installation or a user installation. – vcsjones Sep 22 '17 at 12:42

0 Answers0