title: PowerShell Start-Process with other user credential and wait
body: <p>I am starting a process with <strong>PowerShell</strong> using another user with elevated rights.</p>
  
  <pre><code>$username = "username" 
  $password = "password"
  $startWithElevatedRights = "notepad"
  
  $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
  Start-Process powershell -Credential $credentials -ArgumentList '-noprofile -command &amp;{Start-Process ‘,  $startWithElevatedRights, ‘ -Wait -verb runas}'
  </code></pre>
  
  <p>I know it's bad style to write user credentials to code, but it is used within full automated procedures, so this is necessary.
  My problem is, that I cannot wait until the process (last code line) finished. The inner process waits as expected. </p>
  
  <p>I tried the parameter -Wait, * | Wait-Process, * | Out-Null, with return Value (which is always null)
  Nothing works.</p>
  
  <p>Is there any solution waiting until the process has exited?
  If there is any solution for PowerShell 2.0 it would be the best for my use case.</p>