Process does not run high

Asked

Viewed 92 times

0

I made a program to run the windows activation process high but I get the message of insufficient privilege despite being with Verb = Runes

 var senhaSegura = new System.Security.SecureString();
 var senha = "****"
 foreach (char c in senha)
    senhaSegura.AppendChar(c);
 var process = new System.Diagnostics.Process();
 process.StartInfo = new ProcessStartInfo{
    FileName = "cscript.exe",
    WorkingDirectory = @"c:\windows\system32\",
    UserName = "admin",
    Domain = "transp",
    Password = senhaSegura, //Converte a senha em uma senha segura.
    Verb = "runas", //Aqui executa de forma elevada
    Arguments = "slmgr.vbs -ipk meu serial",
    UseShellExecute = false
    };
  • How will your application run? It’s a console application that generates a common . exe?

  • Running in visual studio 2019

  • you are sure that this app should work on c:\windows\system32\

  • Yes if you search in folder c: windows system32 cscript will be there.

  • Put your app manifest here.

1 answer

0

If I’m not mistaken the only way to do this on Windows is to run your application from the start with high privileges. It is not possible to increase your privileges during execution. Run the generated . exe using Windows "Run as Administrator" or run your Visual Studio as administrator to test.

Q.S.: Sorry for posting an interaction as an answer. I just don’t have enough reputation to comment yet.

  • I saw here on the site saying it works. check out: https://stackoverflow.com/questions/41767759/processstartinfo-verb-runas-notworking

  • If you execute the command runas via command line you will see in the documentation that it is mandatory to enter the desired user as argument. For example: runas /user:nome_usuario "cmd.exe". Try asking the user before via Console.ReadLine() and pass as argument.

  • The user is in the line Username = "admin",

  • I imagine that way the runas It won’t work. Because it’s a simple CLI utility. Try adding next to Verb or arguments. I imagine your result is more positive.

  • could give the example you are proposing?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.