The first ever Windows PowerShell was released over a decade ago for Windows XP, Windows Server 2003 and Windows Vista. It’s been a constant part of all Windows editions since then, starting with Windows 7 in 2009. While there have been many changes made to the software itself, the one thing that has stayed unchanged over the years is the color scheme – a blue background with white/yellow text in general, and red text on a black background for error messages. While most people have gotten used to these colors, some of you may want something more distinctive, either for better visibility or for aesthetic reasons. That being the case, let’s talk a look at how you can change Windows PowerShell color scheme in Windows 10:

Note: Before we proceed, it’s important to understand that this particular tutorial will deal with the PowerShell console, and not the PowerShell ISE, which is one of the two host applications for Windows PowerShell engine and language. It has it’s own customization settings that need to be tackled separately, and is beyond the scope of this tutorial.

Change Background and Foreground Colors in Windows 10 PowerShell Console

  • As mentioned earlier, Windows PowerShell console displays white on blue by default and red on black for error messages, so to change colors, right-click on the PowerShell Window top-bar, and select ‘Properties’.

  • Once the Windows PowerShell ‘Properties’ box pops up, click on the ‘Colors’ tab, and you’ll get a whole host of choices to set background and foreground colors as seen in the screenshot below.

From here, you can change text colors, popup text colors, background colors and even set the opacity levels.

Change Error Message Colors in Windows 10 PowerShell Console

  • While this was a really easy way to change some of the settings, what if you want to do more extensive changes to your PowerShell console? For example, what if you want to change the text and background colors of error messages from red on black to something a little less drastic? For that, you’ll need to get down and dirty and use the console itself rather than rely on GUI. First off, to know the default colors, go ahead and copy/paste this code on the PowerShell console and press ‘Enter’: $host.privatedata

  • To change the foreground and background colors of error messages, all you need to do is assign new values. Since I’d like to change the background color to ‘Magenta’ and foreground color to ‘Green’, I’ll input the two commands below. Just remember to enter them separately and press ‘Enter’ in each case.
    $host.PrivateData.ErrorBackgroundColor = "Magenta"

    $host.PrivateData.ErrorForegroundColor = "Green"

  • You have now configured your console settings, but you’ll need to save them to your profile settings so that the screen opens up exactly as you want it to, every time. For that, first run the command $profile. This will show you the name (and location) of the default file for your profile.

  • In reality, though, the default PowerShell configuration file does not even exist in most cases. So run the following command to check if it already exists or if you need to create it from scratch: test-path $profile. If the file already exists, you’ll get a “True” output, else, you’ll get “False”.

  • As you can see from the above screenshot, I got the latter, so I’ll need to create the file. If you get “True”, skip this step and go to the next. Else, enter the following command to create the file: New-Item -path $profile -type file -force

  • Once the file is created, you can easily edit it with Notepad by using the notepad $profile command in the Powershell Window. From there, you can add whatever configuration code you want to using the commands discussed above. You can not only change colors, but also fonts, windows size, etc through this method, but we’re only going to take a look at changing colors without complicating matters any further.

    $console = $host.ui.rawui
    $console.backgroundcolor = "black"
    $console.foregroundcolor = "white"
    $colors = $host.privatedata
    $colors.verbosebackgroundcolor = "Magenta"
    $colors.verboseforegroundcolor = "Green"
    $colors.warningbackgroundcolor = "Red"
    $colors.warningforegroundcolor = "white"

    $colors.ErrorBackgroundColor = "DarkCyan"
    $colors.ErrorForegroundColor = "Yellow"
    set-location C:\
    clear-host

  • We’re almost there, but there’s one last step. Run the following command to permit local scripts to run on your system: Set-ExecutionPolicy RemoteSigned and select “A” to allow all scripts. Now that you’re done, this is how your PowerShell console would look every time you start it up. Even the errors messages would look a little less jarring than they normally do.

That’s it, folks, I’ve made the Windows PowerShell console on my work laptop look almost exactly like the good old Command Prompt with just a dash of color thrown in for fun.

Note: While the aforementioned steps are meant specifically for Windows 10, I also tried them out on our older Dell desktop running Windows 7. Every step is pretty much identical, and every thing worked as expected.

SEE ALSO: How to Stop Windows 10 Updates From Installing Automatically

Use Simple Commands To Change Windows PowerShell Colors in Windows 10

The Windows PowerShell is a great tool for power users but that doesn’t mean it has to be dull, drab and boring. Tweaking a few setting here and there can make a world of difference to how your PowerShell console looks, so give it a go and change the colors to whatever your heart feels like. And once you do that, don’t forget to give us a heads-up about how things went, because we love hearing from you.

1 COMMENT

LEAVE A REPLY