1

I searched a lot for answers, and tried a bunch of commands, but I can't get my app to work correctly.

My computer only has 1 created account, titled "User". This is a standard User, so I run things with elevated permissions by running a cmd prompt:

runas /user:administrator MYAPP.exe

After hitting enter, I'm immediately prompted for the password. I enter it, and everything works as expected.

In my C# app, I would like to run the above command, with a button click. I am familiar with processes, but nothing I try gets the command to run.

My most recent attempt was this:

    ProcessStartInfo info = new ProcessStartInfo(@"C:\Windows\System32\MYAPP.exe");
    info.UseShellExecute = true;
    info.Verb = "runas";
    info.Arguments = "OFF";
    Process.Start(info);

Yes, the single argument I want to pass to this exe is "OFF". If the EXE properly executes, the computer will reboot automatically. What happens is a blank, un-elevated command prompt opens.

UAC is disabled on this app. Is this why I am having problems?

THANK YOU SO MUCH for your help!

Jon S
  • 13
  • 2

0 Answers0