c# - Application.exe to open as runas administrator -
hey trying launch application.exe runas administrator still not able launch have tried both verb="runas" created app.manifest file exe not opening in administrator mode.
i using code :
var proc = new process { startinfo = new processstartinfo { filename = getasdeploymentexe(), arguments = getasdeploymentcmdargs(), useshellexecute = false, redirectstandardoutput = true, redirectstandarderror = true, createnowindow = true, domain = "***", username = username, password = secstr, verb = "runas" } }; proc.start(); config.asdeploymenttoolpid = proc.id; string line = string.empty; { line = proc.standardoutput.readline(); console.writeline(line); } while (!proc.hasexited); string error = string.empty; while (!proc.standarderror.endofstream) { error = proc.standarderror.readline(); logger.writeerror(error); } }
try this:
//vista or higher check if (system.environment.osversion.version.major >= 6) { p.startinfo.verb = "runas"; }
alternatively, go manifest route application.
Comments
Post a Comment