Search notes:

Powershell: $host.privateData

$host.privateData is a PSObject whose members store the foreground and background colors for the following message types:
Except the missing information, these elements correspond to the messages that can be written with the write cmdlet verb suach as write-error or write-progress.
The names of the properties of $host.privateData are debugBackgroundColor, debugForegroundColor etc. Their type is System.ConsoleColor
The following two assignments cause error messages to be reported in red on a yellow background:
$host.privateData.errorBackgroundColor = 'yellow'
$host.privateData.errorForegroundColor = 'red'

write-error 'red on yellow'

See also

The background and foreground color of a PowerShell console can be set with the two properties backgroundColor and foregroundColor of the $host.ui.rawUI.

Index