I want to open a console using credentials of someone else.
Normally I do it with the runas
command:
C:\> runas /user:$(cat ~\.ssh\ek | select -first 1) pwsh
Enter the password for ***:
Attempting to start pwsh as user *** ...
C:\>
Having entered the password, I can see the console opened and it works great.
However, I do not like that I have to type the password every time.
The Powershell's Start-Process
should help, because I can pass it a credentials object.
For example:
C:\> $creds = Import-Clixml -Path ~/.ssh/ek.creds
C:\> Start-Process pwsh -Credential $creds -WorkingDirectory ***
C:\>
At the end a console is open, but I am unable to use the keyboard - nothing happens when typing or pasting.
What am I missing?
This is a long standing bug that occurs because of the -Credential parameter. When you omit that parameter, the console would not freeze.
Related Github issues
To solve this issue, store your credential in the Credential Manager
You will have to enter the password the first time, but all subsequent calls will work without interaction until you clear the password from the Credential Manager. Security wise this is just as secure as storing an encrypted file on disk.