For anyone else reading this - got this working using wyupdate.exe.
proc.Dispose(); was not behaving properly. It had issues with me calling it twice - once to check for updates, once to run updates.
I was able to fix this by wrapping the Process code - using (Process proc = new System.Diagnostics.Process()){}
Here is the final working code:
------------------------------------------------------------------------------------------------------------------
public static Int32 RunExe(String ExeFileWithPath, String arguments) { try { System.Diagnostics.ProcessStartInfo file_to_process = new System.Diagnostics.ProcessStartInfo(ExeFileWithPath); using (Process proc = new System.Diagnostics.Process()) { proc.StartInfo = file_to_process; proc.StartInfo.Arguments = arguments; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.ErrorDialog = false; proc.Start(); proc.WaitForExit(Int32.MaxValue);
if (proc.HasExited) { Int32 exitCode = proc.ExitCode; proc.Close(); proc.Dispose();
if (exitCode == 1) { Common.Common.WriteToEventLog( "Exit Code = " + exitCode + "; Proc.StandardError: " + proc.StandardError.ReadToEnd(), EventLogEntryType.Error); } return exitCode; } } return -1; } catch (Exception ex) { Common.Common.WriteToEventLog("{RunExe} " + ex.Message, EventLogEntryType.Error); return -1; }
}