0

I want to execute a .exe File with the Start-Process Command while using specific credentials.

However I cant get it to work for me:

$username = "<Domain\Username>"
$password = "<Password>"
$secPassword = ConvertTo-SecureString $password -AsPlainText -Force
$credentialps = New-Object System.Management.Automation.PSCredential ($username, $secPassword)
Start-Process -FilePath "<path to exe>\Test.exe" -Credential $credentialps -NoNewWindow -ArgumentList "<Arguments>"

This outputs the following error:

Start-Process : This command cannot be run due to the error: The parameter is incorrect.

I Also tried just using $credential = Get-Credential, this gives you back an PSCredentials Object, but it gave me the same error.

What am I doing wrong? Sorry if something's missing, Iam new to Powershell :)

Edit: After removing the Credentials parameter the script runs perfectly, so there shouldnt be a problem regarding the FilePath or Argumentlist.

Z0rumi
  • 1
  • 1
  • Possible duplicate of [Start-process raises an error when providing Credentials - possible bug](https://stackoverflow.com/q/7319658/9898643) – Theo Feb 14 '23 at 15:35

0 Answers0