PowerShell / PowerShell/Win32-OpenSSH

Windows console colors do not work from a command over ssh.

Open
#1,870 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

"OpenSSH for Windows" version
8.0.0.0

Server OperatingSystem
Windows 10 Pro

Client OperatingSystem
Windows 10 Pro

What is failing
Commands that produce console color output executed as a command, for example:

ssh localhost 'write-host TEST -foregroundcolor magenta'

Commands that just use an ANSI code work fine, for example:

ssh localhost 'write "`e[95mTEST`e[0m"'

works fine.

Expected output

The word TEST in magenta color.

Actual output

The word TEST in normal color.

I have PowerShell core set as the default shell, here is the output of $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Microsoft Windows 10.0.22518
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the ssh localhost 'write-host TEST -foregroundcolor magenta' command and compare it with the ANSI escape example in the report. Investigate the Windows OpenSSH console or pseudo-terminal handling for PowerShell commands. Done means Write-Host color output is preserved when executed remotely, with a regression test covering the command path.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.