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?
4 Answers
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?
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.
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.
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.
Exactly this.