Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn, Powered by You.
you are not logged in





Site Services

Community Forums

Discussion Lists

Article Search


Web Blogs


Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us





Industry News:

  Home : Articles : Scripting print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
Windows PowerShell Colors

Bookmark and Share

By: Don Hite
Posted On: 10/16/2006

Windows PowerShell Colors

This article was Previously posted on Don Hite's Blog

The PowerShell console allows you to use the following colors: Black, Blue, DarkBlue, Cyan, DarkCyan, Gray, DarkGray, Green, DarkGreen, Magenta, DarkMagenta, Red, DarkRed, White, Yellow and DarkYellow. However not all of the colors are utilized.

By default the PowerShell Console Color Proxy object colors are listed below:

DebugForeGroundColor: Yellow
DebugBackGroundColor: Black
ErrorForeGroundColor: Red
ErrorBackGroundColor: Black
ProgressForeGroundColor: Yellow
ProgressBackGroundColor: DarkCyan
VerboseForeGroundColor: Yellow
VerboseBackGroundColor: Black
WarningForeGroundColor: Yellow
WarningBackGroundColor: Black

You can however change the ConsoleColorProxy object colors above by executing the following command in the PowerShell console where Object_Name is an Object listed above:

$Host.PrivateData.Object_Name = "Selected_Color"

Example: $Host.PrivateData.ErrorBackGroundColor = "DarkGreen"

You also have the ability to change or configure your PowerShell console screen (BackGround) and text (ForeGround) color scheme by editing your PowerShell user Profile (Profile.Ps1) if you want to save your color scheme each time the PowerShell console is executed using either of the examples below:

• To change your screen or background color set the following:
$Host.Ui.RawUi.BackGroundColor = "Selected_Color"

• To change your test or foreground color set the following:
$Host.Ui.RawUi.ForeGroundColor = "Selected_Color"

Use the script below to see all of the colors available to you from within the PowerShell console:

Note: Save the file with the Ps1 file extension to make it executable as in PowerShellColors.Ps1

Ps1 Script:

Write-Host ""
Write-Host "ForeGround Colors:"
Write-Host "Black" -Fore Black
Write-Host "Blue" -Fore Blue
Write-Host "Dark Blue" -Fore DarkBlue
Write-Host "Cyan" -Fore Cyan
Write-Host "Dark Cyan" -Fore DarkCyan
Write-Host "Gray" -Fore Gray
Write-Host "Dark Gray" -Fore DarkGray
Write-Host "Green" -Fore Green
Write-Host "Dark Green" -Fore DarkGreen
Write-Host "Magenta" -Fore Magenta
Write-Host "Dark Magenta" -Fore DarkMagenta
Write-Host "Red" -Fore Red
Write-Host "Dark Red" -Fore DarkRed
Write-Host "White" -Fore White
Write-Host "Yellow" -Fore Yellow
Write-Host "Dark Yellow" -Fore DarkYellow
Write-Host "" ©2010 | Legal | Privacy