I have the following piece of service code to install a group of MSI files copied to a given directory:
private void InvokeInstallersIn(string path)
{
var di = new DirectoryInfo(path);
foreach (FileInfo fileInfo in di.GetFiles("*.msi"))
{
try
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"msiexec.exe"; // Specify exe name.
start.UseShellExecute = true;
start.RedirectStandardOutput = false;
start.WorkingDirectory = path;
var arguments = @"/I /l*v install.log /qn " +
fileInfo.Name + " REINSTALL=All REINSTALLMODE=amus";
start.Arguments = arguments;
Logger.Info("Process: msiexec.exe {0}", arguments);
Process process = Process.Start(start);
process.WaitForExit(30000);
}
catch (System.Exception e)
{
Logger.ErrorEx(e, "Error installing '{0}'", fileInfo.Name);
}
}
}
Whenever it invokes msiexec it ends up displaying the usage dialog instead of performing the installation.
Update
I can install the MSI via windows explorer, but cannot from the command line at all. In addition I cannot change the file privileges on the msi file, and the installer displays the "This file does not have a valid digital signature..." warning when I invoke via explorer. (I'd copied this file to a share on my own machine and am accessing it in explorer via \localhost\MyShare). Perhaps the question is now - how do I choose to override this warning from the command line.
Any clues as to where I'm going wrong?