Reputation: 823
I have an msi installer that I need to install it silently from the 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 is working fine if I manually run it from the cmd as admin
when I run it I just get the cmd screen in admin mode but the command does not executing
Upvotes: 15
Views: 15634
Reputation: 4906
This is also going to help you:
Process process = new Process();
process.StartInfo.FileName = "msiexec.exe";
process.StartInfo.Arguments = string.Format("/qn /i \"{0}\" ALLUSERS=1", @"somepath\msiname.msi");
process.Start();
process.WaitForExit();
Upvotes: 5
Reputation: 823
as V2Solutions - 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 :)
Upvotes: 14