Changing PowerShells Look and Feel

In this tutorial, you will learn how to change the look and feel of PowerShell ISE. Everyone is different of course, so user interface color, window size, etc., may bse customized to suit individual needs.

Setup

If you have not already done so, click on your start button and type in Windows PowerShell. Go ahead select and open Windows PSH(Command Shell).

Step one.

In the window, type in:

Example

$Host.UI.RawUI.BackgroundColor="DarkRed"
 
$Host.UI.RawUI.ForegroundColor="white"
    

Copy and Try it

Hit Enter.

You will find from the output that your text is now white and the background color is a dark red. You may put only select colors in both foreground color and background color. If you place a color name other than what is allowed, the output will give you an error that includes the colors that are allowed.

NOTE*** $Host is a variable that is a reference to the current console object. When you assign the color, it is assigning it to the UI.RawUI.BackgroundColor and UI.RawUI.ForegroundColor properties of the console object.

Step two.

Personally, larger windows allow me to see more code, and I'm sure many of you are the same. To run the current values, run the following PSH commands:

Example

$Host.UI.RawUI.BufferSize
 
$Host.UI.RawUI.WindowSize
    

Copy and Try it

For some the default size is fine and all, but for others some things will have to change. Now for the do's and don'ts of changing size values.

For some the default size is fine and all, but for others some things will have to change. Now for the do's and don'ts of changing size values.

Example

Do NOT do this:
 
$Host.UI.RawUI.BufferSize = 110
 
$Host.UI.RawUI.WindowSize = 40
    

Copy and Try it

PSH will not give out an error, however this code is dead. It does absolutely nothing to the size and if you try again, you will see the same values are there.

What did this do? And why did we have to do it like so? As we previously found out, simply assigning a value to the properties would not have done anything to the change the sizes. So what we had to do was create an object of variable type, WindowSize, set its width and height properties, then assign the new value to WindowSize. In executing the commands, we stored the value of WindowSize in a variable called $size. Since the variable is of type WindowSize, we assigned the new width and height values to it and then reassign the entire object back to WindowSize. If you are to reassign BufferSize, simply place BufferSize where WindowSize is in the code provided. You can set the width and height values to be whatever you like them to be of course.

Step three.

You may change the title of the PSH window. Copy the following code and past it in the window.

Example

#So, DO this:
 
$size = $Host.UI.RawUI.WindowSize 
 
$size.Width = 100
 
$size.Height = 25
 
$Host.UI.RawUI.WindowSize = $size
    

Copy and Try it

Hit enter. Look at the top of your Window, you will now see PowerShell Master as your title instead of Window's PowerShell.

Remarks last but not least…

Hopefully you have seen some neat ways to give your environment a sort of unique touch and feel. These usually help when some colors are more visible than others and when window sizes impede on the work environment. Join us next time when we show you how to change your PSH Profile. Till then…