I have a task to develop an update agent that launches an msi file after downloading it, the installation has to be invisible to the user.
But i have a problem with launching it with no UI. I tried using /q
and /qn
but it doesn't work, it only works with UI options.
internal static class MSI_runner
{
public static bool RunInstallMSI(string sMSIPath)
{
try
{
Console.WriteLine("begin");
//Starting to install application
Process process = new Process();
process.StartInfo.FileName = "msiexec.exe";
process.StartInfo.Arguments = string.Format(" /q /i \"{0}\" REINSTALLMODE=amus ", sMSIPath);
Console.WriteLine("start");
process.Start();
process.WaitForExit();
Console.WriteLine("end");
return true;
}
catch
{
// "There was a problem installing the application!
return false; //Return False if process ended unsuccessfully
}
}
}