Integrated Console Colors do not work on older Windows Versions without ANSI/VTY Support (2012R2 etc.)
See original GitHub issuePrerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
VScode with this extension have worked great for roughly a year but at some point I’m not sure of, a weird issue started happening on my dev server (Windows Server 2012 R2). ANSI characters started showing up in the integrated console.
Expected:
PS C:\Users\me> get-host
Name : ConsoleHost
Version : 7.2.1
InstanceId : fd6bb11f-cb31-4266-a524-4ff936a460bf
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Actual:
PS C:\Users\me> get-host
[32;1mName : [0mVisual Studio Code Host
[32;1mVersion : [0m2021.10.2
[32;1mInstanceId : [0mc1c2393e-ac91-4757-826e-b9cdb6392c14
[32;1mUI : [0mSystem.Management.Automation.Internal.Host.InternalHostUserInterface
[32;1mCurrentCulture : [0men-US
[32;1mCurrentUICulture : [0men-US
[32;1mPrivateData : [0mMicrosoft.PowerShell.EditorServices.Services.PowerShellContext.EditorServicesPSHost+ConsoleColorProxy
[32;1mDebuggerEnabled : [0mTrue
[32;1mIsRunspacePushed : [0mFalse
[32;1mRunspace : [0mSystem.Management.Automation.Runspaces.LocalRunspace
Things I’ve already tried:
Google of course Un/Re install VScode Upgraded PWSH Tested the command directly in the native pwsh shell and works perfectly (seems to suggest something within the VScode integrated console)
PowerShell Version
PS D:\scripts> $psversiontable
[32;1mName Value[0m
[32;1m---- -----[0m
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
### Visual Studio Code Version
```console
PS D:\scripts> code --version
1.63.1
fe719cd3e5825bf14e14182fddeb88ee8daf044f
x64
PS D:\scripts>
### Extension Version
```console
PS D:\scripts> code --list-extensions --show-versions | Select-String powershell
ms-vscode.powershell@2021.10.2
ms-vscode.powershell-preview@2021.11.1
tobysmith568.run-in-powershell@1.1.1
PS D:\scripts>
### Steps to Reproduce
1. Open VSCode on Windows Server 2012 R2
2. Ensure the stable version of PowerShell is enabled with PowerShell 7.2.X installed
3. Run a simple command like "Get-Host"
Extra info:
If I disable the "stable" version of the extension, reload, and enable the "preview" version, the ANSI characters are no longer displayed which is good. (No color though, not sure if it's supposed to or not. Also, another issue with Preview is that when a command finishes, the cursor is not visible until you hit enter on the keyboard so you're never sure if the command finished yet or not but that's another issue for Preview)
### Visuals
See the summary for a text preview
### Logs
What's weird is that when I enable "debug" logs, I do not see the issue (weird!). When I put it back to "normal" the issue happens again. I will send an email with the zipped files.
Issue Analytics
- State:
- Created 2 years ago
- Comments:22 (10 by maintainers)
Top Results From Across the Web
Workarounds for Visual Studio 2022 on unsupported ...
This article describes known issues and workarounds for Visual Studio 2022 when installed on unsupported operating systems.
Read more >Bash terminal colors in integrated terminal in VS Code
I was able to get colors to work in my Bash integrated terminal in VSCode by configuring my C:\Program Files\Git\etc\bash.bashrc file.
Read more >Windows console with ANSI colors handling - Super User
None of the answers on this page mention an important aspect of the new support for ANSI Terminal Control which was added to...
Read more >Configuring SFTP (SSH FTP) Server on Windows
SFTP (Secure File Transfer Protocol, Secure FTP, or SSH FTP) is the ... The previous command won't work in old desktop Windows versions....
Read more >Use ANSI colors in the terminal - Windows CMD - SS64.com
ANSI colors are available by default in Windows version 1909 or newer. See below for older versions. Specify the color codes in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mhdevop seeing as 2012R2 is EOL in a year and a half, I doubt a lot of engineering effort is going to go into this honestly, unless someone wants to attempt a PR, which we will facilitate.
I am going to rename the issue to be 2012 specific and flag it as “up for grabs”
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes.