diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs index ef7c40fd37..f4b9d03489 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1296,6 +1296,16 @@ namespace System.Management.Automation.Runspaces $myinv = $err.InvocationInfo } + if ($ErrorView -ne 'ConciseView' -and $null -ne $host.PrivateData) { + if ($null -ne $host.PrivateData.ErrorForegroundColor) { + [Console]::ForegroundColor = $host.PrivateData.ErrorForegroundColor + } + + if ($null -ne $host.PrivateData.ErrorBackgroundColor) { + [Console]::BackgroundColor = $host.PrivateData.ErrorBackgroundColor + } + } + if ($err.FullyQualifiedErrorId -eq 'NativeCommandErrorMessage' -or $err.FullyQualifiedErrorId -eq 'NativeCommandError') { $err.Exception.Message }