title: MSOLEDBSQL Driver installation fails with C#
body: <p>I need to install the MSOLEDBSQL driver (msi file) programmatically, for which I have written the function below :</p>
  <pre><code>public static void InstallSQLDriver()
          {
              
              string msiPath = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)+@&quot;\msoledbsql.msi&quot;;
              string winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
              ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(winDir, @&quot;System32\msiexec.exe&quot;), $&quot;/i {msiPath} /quiet /qn /norestart ALLUSERS=1&quot;);
              startInfo.Verb = &quot;runas&quot;;
              startInfo.UseShellExecute = true;
              Process proc = Process.Start(startInfo);
              proc.WaitForExit();
              Console.WriteLine(&quot;process ended with : &quot; + proc.ExitCode);
          }
  </code></pre>
  <p>This runs fine on the dev machine and exits with status code 0 (success), However, when I run the .exe on another machine, it gives me the exit code 1603. When I look through the eventviewer logs I see an error saying that the IACCEPTSQLSERVERLICENSETERMS=YES parameter is missing. I tried add the parameter in the startInfo variable as below :</p>
  <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(winDir, @&quot;System32\msiexec.exe&quot;), $&quot;/i {msiPath} /quiet /IAcceptMSOLEDBSQLLicenseTerms/qn /norestart ALLUSERS=1&quot;);
  </code></pre>
  <p>but this doesn't work and I get the 1639 error code, which says this parameter is invalid.</p>
  <p>Can someone please tell me how to include this parameter in my startInfo variable?</p>