title: Why is Powershell returning no ExitCode on Windows 7
body: <p>I'm trying to write a script to install software on many computers. The problem is, they have to be installed in specific order and I need to know that the first installation succeeded before running the second one.</p>
  
  <p>here's the important code:</p>
  
  <pre><code>[...]
  
  # source_one
  $Argumente = @("/i", $path_to_source, "/qb", "ADDLOCAL=ALL")
  if (!$visWeb_upToDate)    { 
    Write("VIS Web-Client Installation...")
    $procWeb = Start-Process msiexec.exe -ArgumentList $Argumente -Verb runAs -PassThru 
    $procWeb.WaitForExit()
    Write-Debug($procWeb.ExitCode)
  
    if ($procWeb.ExitCode -eq 0){
      Write("... erfolgreich.")
      $visWeb_upToDate = $true;
    }
    else {
      Write-Error("... nicht erfolgreich.")
      Write-Error("Bitte Clients manuell installieren.")
    }
  }
  
  # source_two
  if ($visWeb_upToDate -and !$vis64_upToDate){
    Write("VIS 64-Bit Client Installation...")
    $Argumente[1] = $path_to_another_source
    $procWeb64 = Start-Process msiexec.exe -ArgumentList $Argumente -Verb runAs -PassThru 
    $procWeb64.WaitForExit()
    Write-Debug($procWeb64.ExitCode)
  
    if ($procWeb64.ExitCode -eq 0){
      Write("... erfolgreich.")
      $vis64_upToDate = $true
    }
    else {
      Write-Error("... nicht erfolgreich.")
      Write-Error("Bitte 64-Bit Client manuell installieren.")
    }
  }
  
  [...]
  </code></pre>
  
  <p>I don't get <code>$procWeb.ExitCode</code> on Windows7 Powershell. On Win8 it works just fine and installs <code>source_one</code> and <code>source_two</code> only on success of the first. </p>
  
  <p>Does somebody know how to fix this, or
  is there some other way to set <code>$visWeb_upToDate = $true</code> for both systems?</p>
  
  <p>Many thanks in advance.</p>