title: How can I make PowerShell wait until a command is complete before proceeding?
body: <p>I'm using the following line to uninstall office 2007 based on its Product ID</p>
  
  <pre><code>Start-Process C:\Windows\System32\msiexec.exe -ArgumentList "/uninstall {90120000-0030-0000-0000-0000000FF1CE}"
  </code></pre>
  
  <p>I'd like to force a reboot after the uninstall is complete however using -Wait or piping the results to Out-Null don't wait until the uninstall is complete before processing the next line which is a restart.  I've also tried using cmd to uninstall but with the same result.</p>
  
  <pre><code>cmd /c "msiexec.exe /uninstall {90120000-0030-0000-0000-0000000FF1CE}"
  </code></pre>
  
  <p>Is there any way to force powershell to wait until the uninstall is complete before processing the Restart-Computer command?  I was thinking possibly writing something that detects when the setup.exe process stops before proceeding to the restart?</p>