0
how to bring up a cmd console window in admin
working on a program that runs different cmd console commands. I can get it to ping other computers tracert computers but unable to get a remote shutdown command to go through I think it needs command prompt to use admin rights to work this is on a domain based network. I can send the commands if I open my own cmd prompt. Below is the code i am using private void button5_Click(object sender, EventArgs e) { //restart command string pcname; string restart; string strCmdText; pcname = Convert.ToString(PC.Text); restart = Convert.ToString(ReasonforRestart.Text); strCmdText =
quot;/k shutdown /r /m \\{pcname} /c {restart} /t 10"; System.Diagnostics.Process.Start("CMD.exe", strCmdText); //shutdown /r \\pcname /c restart1 Réponse
0
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.Verb = "runas";
Process.Start(psi);
From Stackoverflow:
http://stackoverflow.com/questions/34818884/c-sharp-run-cmd-as-administrator