Credencial stuck

$user = “mvtappl\Sherutop”
$pwd1 = Get-Content “C:\scripts\sharut.txt” | ConvertTo-SecureString
$Credential = New-Object System.Management.Automation.PSCredential $user, $pwd1
Start-Process ‘\sniffiler\hatkanot\Tools\folder.exe’ -RunAs $Credential

when i convert this script to exe with Invoke-PS2EXE command and try to engage it, its stuck, in powershell without exe convert work perfectly, when i omit the "-RunAs " command its run good, but i need the credencial , what can i do? ,10x

I have a couple of thoughts for you. First, please format your code as preformatted text (behind the gear icon) - it makes your question much more readable.

Next, to use start-process to run something as another user, you need to use the -Credential parameter - there is no -RunAs parameter. There is “-Verb RunAs” but that is for starting a process elevated, not for alternate credentials.

Also, I would strongly discourage you from storing passwords in a text file. That is a huge security risk. PowerShell has secrets management capabilities that are far more secure - you can store your credential object in the vault (username and password) and retrieve it securely from your script.