How to run MSI installer in cmd as admin using c #
I have an msi installer that I need to install quietly from C #
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = "msiexec /quiet /i Setup.msi ADDLOCAL=test";
process.StartInfo.Verb = "runas";
process.Start();
process.WaitForExit(60000);
noting that the cmd command works fine if I manually run it from cmd as admin
when i run it i just get cmd screen in admin mode but command fails
+3
source to share
2 answers
like V2Solutions is the MS team mentioned, the solution is to change the following
process.StartInfo.FileName = "msiexe.exe"
and the code will be
Process process = new Process();
process.StartInfo.FileName = "msiexec";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = " /quiet /i Setup.msi ADDLOCAL=test";
process.StartInfo.Verb = "runas";
process.Start();
process.WaitForExit(60000);
this works for me :)
+3
source to share