/// <summary> /// Runs the uninstall string, silent & hidden process. /// </summary> /// <param name="UnApp">Variable of type MSIprop.</param> /// <param name="guid">The argument used to run MSI.</param> /// <returns>Returns updated MSIprop from the process performed.</returns> private static MSIprop RunUninstallMSI(MSIprop UnApp, string guid) { try { ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe", string.Format("/c start /MIN /wait msiexec.exe /x {0} /quiet", guid)); startInfo.WindowStyle = ProcessWindowStyle.Hidden; Process process = Process.Start(startInfo); Logger.Log("Attempting to uninstall {0}", LogLevel.Info, UnApp.AppName); process.WaitForExit(); if (process.ExitCode != 0) { Logger.Log("Uninstall attempt failed with cmd exit code {0}-{1}", LogLevel.Error, process.ExitCode, CmdExitCode.CmdExitCodeString(process.ExitCode)); } UnApp.UninstallPass = true; return(UnApp); } catch { Logger.Log("MSI/CMD catastrophic failure while trying to uninstall {0}", LogLevel.Error, UnApp.AppName); UnApp.UninstallPass = false; UnApp.Error = UnApp.Error + "MSI/CMD catastrophic failure."; return(UnApp); } }