Share This Post

PowerShell

Changing PowerShell Session Console Colors

Changing PowerShell Session Console Colors

Not happy with the default white text on blue background colors for the PowerShell window? Here’s how you can change them.

Determine the colors of the error messages

$host.privatedata

Result:

ErrorForegroundColor : Red
ErrorBackgroundColor : Black
WarningForegroundColor : Yellow
WarningBackgroundColor : Black
DebugForegroundColor : Yellow
DebugBackgroundColor : Black
VerboseForegroundColor : Yellow
VerboseBackgroundColor : Black
ProgressForegroundColor : Yellow
ProgressBackgroundColor : DarkCyan

Change the colors of the error messages

Example: $host.PrivateData.ErrorBackgroundColor = “White”

Determine the colors of the standard console

$host.ui.rawui

Result:

ForegroundColor : DarkYellow
BackgroundColor : DarkMagenta
CursorPosition : 0,1
WindowPosition : 0,0
CursorSize : 25
BufferSize : 120,3000
WindowSize : 120,50
MaxWindowSize : 120,72
MaxPhysicalWindowSize : 274,72
KeyAvailable : False
WindowTitle : Administrator: Windows PowerShell

Change the colors of the standard console

Background: $host.PrivateData.ErrorBackgroundColor = “Black”
Foreground: $host.PrivateData.ErrorForegroundColor = “White”

Looking for an awesome, no-nonsense technical conference for IT Pros, Developers, and DevOps? IT/Dev Connections kicks off in Dallas, Texas in 2018!

IT/Dev Connections

Share This Post

Leave a Reply