Fun with PowerShell ISE

A popular PowerShell version 2 feature is the graphical PowerShell console, known as the Integrated Script Environment or ISE. The ISE has its own object model which means you can customize it. Here a few things you might want to tweak, or at least experiment with. 

First, open the ISE and in the command panel type:

$psise.options

You should get output like this.

SelectedScriptPaneState       : Top
ShowToolBar                   : True
TokenColors                   : {[Attribute, #FFADD8E6], [Command, #FF0000FF],
                                [CommandArgument, #FF8A2BE2], [CommandParameter
                                , #FF000080]…}
DefaultOptions                : Microsoft.PowerShell.Host.ISE.ISEOptions
FontSize                      : 12
FontName                      : Lucida Console
ErrorForegroundColor          : #FFFF0000
ErrorBackgroundColor          : #00FFFFFF
WarningForegroundColor        : #FFFF8C00
WarningBackgroundColor        : #00FFFFFF
VerboseForegroundColor        : #FF0000FF
VerboseBackgroundColor        : #00FFFFFF
DebugForegroundColor          : #FF0000FF
DebugBackgroundColor          : #00FFFFFF
OutputPaneBackgroundColor     : #FFF0F8FF
OutputPaneTextBackgroundColor : #FFF0F8FF
OutputPaneForegroundColor     : #FF000000
CommandPaneBackgroundColor    : #FFFFFFFF
ScriptPaneBackgroundColor     : #FFFFFFFF
ScriptPaneForegroundColor     : #FF000000
ShowWarningForDuplicateFiles  : True
ShowWarningBeforeSavingOnRun  : True
UseLocalHelp                  : True
CommandPaneUp                 : False

On one of my laptops, the screen resolution is 1900×1200 so 12 points is pretty hard to read. But it is easy to change with this command:

$psise.options.fontsize=20

The font size is changed immediately in all panels. It also applies to any new tabs I might open and is persistent. When I restart the ISE, the font size remains the same. Of course you can also simply rescale using the text slider in the lower right corner, but where’s the challenge in that!

Of course you can also change the font itself. This is a lot of fun. Try these commands to see for yourself.

$psise.options.fontname=”tahoma”

$psise.options.fontname=”courier new”

$psise.options.fontname=”segoe print”

$psise.options.fontname=”comic sans ms”

$psise.options.fontname=”chiller”

These changes also affect all panels and all tabs. You may also need to adjust font sizes for some of these fonts. Not every font will work. Unlike font size, these changes are not persistent so if you would like a different font every time, add the appropriate code to your ISE profile.

This is a different profile than what you use with the regular PowerShell  console.  In the ISE type $profile to see the name of your profile. You may have to create it.

if (!(test-path $profile ))
{new-item -type file -path $profile -force}

Open the file in PrimalScript and edit.  The ISE offers a wealth of opportunities so I’ll be back with more goodies from time to time.