title: Powershell running as a another user with elevated privileges
body: <p>I have two scripts located in C:\setup: script.ps1 and script1.ps1.</p>
  
  <p>I want to be able to run the script1.ps1 from withing script.ps1 as another user and with elevated privileges but I cannot make it work. The new powershell window opens but closes immediately ...</p>
  
  <p>here is the script:</p>
  
  <pre><code> $cspath = $MyInvocation.MyCommand.Path
   $sfolder = Split-Path $cspath
   $spath = Join-Path $sfolder "\Script1.ps1"
  
   $sa = "domain\user"
   $sap = "userpassword"
   $sasp = ConvertTo-SecureString -String $sap -AsPlainText -Force
   $sac = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $sa, $sasp 
  
  
   Start-Process $PSHOME\powershell.exe `
              -Credential $sac `
              -ArgumentList "-Command Start-Process $PSHOME\powershell.exe -ArgumentList `"'$spath'`" -Verb Runas" -Wait 
  </code></pre>
  
  <p>Any help will be appreciated ...</p>