I am having troubles executing commands in a remote PowerShell session which need user interaction.
Example: I enter a remote session
Enter-PSSession -ComputerName mobius
In this session I execute a command which asks for a password:
[mobius]: PS C:\Windows\system32> & 'c:\Program Files (x86)\Putty\plink.exe' merlin -l joe
joe@merlin's password:
c:\Program Files (x86)\Putty\plink.exe : Using username "plakat".
+ CategoryInfo : NotSpecified: (Using username "plakat".:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
The last two lines are displayed in red. There seem to be two problems.
Problem 1: plink.exe writes the text 'Using username "plakat"' to stderr. This probably causes the error message. Can I suppress this somehow? (pipe stderr to stdout or something.)
Problem 2: The process exits at the point where I should enter the password. I can also reproduce that with other commands like
[mobius]: PS C:\Windows\system32> cmd /c date
It does not let me enter a date. Both commands work if I run them in a local PowerShell. Neither Problem 1 or 2 are showing in that case.