Why is the Edit command not working in a remote PowerShell session?
Asked by
spin+4C
I'm trying to use the Edit command, which is part of Microsoft's new editor, during a remote PowerShell session. However, when I run the command after entering the session with Enter-PSSession -ComputerName PC1, I get an error: Error 0x80070006: The handle is invalid. Is there any way to make this work, or am I missing something?
Answers
So, the issue here is that Enter-PSSession doesn't provide a fully interactive console environment, which means applications that require direct console input/output, like Microsoft Edit, wonโt function as expected. You might want to look into using SSH instead, as it creates a proper terminal session that supports TUI apps.
Reply to this answer
Itโs literally four letters, man. A quick Google search for "Microsoft edit" would bring it up as the first result. Hereโs a link to the GitHub page for it: https://github.com/microsoft/edit. If you're unsure, sometimes it's best just to not comment if you can't help.
Reply to this answer
Yeah, this is pretty common when using PowerShellโs remoting. No TUI tools will work over it because it doesn't create a TTY environment, just routes inputs and outputs. For example, editors like vim don't work either, so going with SSH is definitely the way to go.
Reply to this answer
Which new editor are you talking about? Is it the Microsoft Editor? Thatโs been around since July 2016, but you might mean something else. Could you clarify?
Reply to this answer
Add your answer
Answers are reviewed before publication.
WHIRLPOOL: Exactly this.