I have a PowerShell script that calls out to sqlcmd. After it returns, it seems that it has disabled all the color output in PowerShell (v7.2.0) and I'm getting the ANSI escape sequences output in the window (e.g. [33;1m
) I've tried calling [Console]::ResetColor()
but that doesn't seem to do anything.
Any ideas how to tell Powershell to start interpreting the color escape sequences instead of printing the extra garbage in the console?
Example the reproduces the problem:
Write-Warning "hello world"
$process = Start-Process sqlcmd -ArgumentList @('-Q',"`"$($Command)`"") -PassThru -NoNewWindow -Wait
Write-Warning "hello again"