Score:1

runas vs Start-Process - no keyboard (or any at all) input in the console open by Start-Process

br flag

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?

Score:1
ru flag
Jan

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

runas /user:$(cat ~\.ssh\ek | select -first 1) /savecred pwsh

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.