title: retrieving installation wizard's exit code to understand what button user pressed with PowerShell script
body: <p>I have some PowerShell scripts that launch an uninstall wizard. After the wizard I have some code to clean things up. I don't want to execute that code if the user presses the Cancel button on the wizard. The only way I know from (other uninstall wizards) what the user has pressed is by inspecting the ExitCode like so:</p>
  <pre><code>$fileArg = &quot;/q&quot;;
  $proc = Start-Process &quot;C:\Program Files\erl-23.2\Uninstall.exe&quot; -ArgumentList $fileArg -PassThru -Wait;
  $proc.ExitCode;
  </code></pre>
  <p>The problem is that this particular uninstall.exe gives me the same exit code of 0 regardless if the user presses Next and uninstalls or if they press the Cancel button. I cannot tell the difference. Other uninstall wizards give me 1 when the Cancel button was pressed and other values if something else happens.</p>
  <p>Is there some other way to know what button the user has pressed or at least tell the difference between the Cancel button and all other actions?</p>