title: Start-Process powershell credentials don't work but when using cmd it does
body: <p>I am trying to run a powershell script from another powershell script passing in the credentials of a different user and then using the credentials:</p>
  
  <pre><code>Start-Process powershell.exe -Credential "LON\my-user" -NoNewWindow -ArgumentList "-file C:\DevopsScripts\stuckApps.ps1"
  </code></pre>
  
  <p>I have this is numerous different ways all get the same error. I have tried setting the username and password before the command:</p>
  
  <pre><code>$username = "LON\my-user"
  $password = "pass"
  $PSS = ConvertTo-SecureString $password -AsPlainText -Force
  $cred = new-object system.management.automation.PSCredential $username,$PSS
  $env:USERNAME 
  Start-Process powershell.exe -Credential $cred -NoNewWindow -ArgumentList "-file C:\DevopsScripts\stuckApps.ps1"
  </code></pre>
  
  <p>But everything I try gets the error:</p>
  
  <blockquote>
    <p>Start-Process : This command cannot be run due to the error: The user name or password is incorrect.</p>
  </blockquote>
  
  <p>I know the username and password are correct as they have been tested on the cmd which it works fine:</p>
  
  <pre><code>C:\Users\ADM-me&gt;runas /noprofile /user:LON\my-user"powershell.exe C:\DevopsScripts\stuckApps.ps1"
  </code></pre>
  
  <p>What am I doing wrong here and how could I fix this, preferably by setting the password beforehand, so this can be automated.  Also this does not need to be done using Start-Process, just this is the closest thing I could find to working.</p>
  
  <p>I think the problem I am having is this, in stuck apps it has this:</p>
  
  <pre><code>$conn = New-Object System.Data.SqlClient.SqlConnection
  $conn.ConnectionString = "Server = mssql.co.uk; Database = mydata; Integrated Security = true;"
  $conn.Open()
  </code></pre>
  
  <p>I need this to run the credentials that I am trying to pass through it or else I get this error.
   `Exception calling "Open" with "0" argument(s): "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."</p>
  
  <p>But I can't pass the credentials through as the only ones that work are admin ones, (which I have but then that will throw the error above).  Is it possible for me to use the admin logins to access stuck apps then use the logins needed to connect on stuck apps as an AD login.</p>