Prof. Powershell

ISE Cool

Do you want your PowerShell environment settings to stick as you're whistling and working? Check out the ISE's very own $psISE object for ideas.

I find myself using the Windows PowerShell Integrated Script Editor (ISE) more and more these days. One terrific feature I find totally cool (or whatever the kids are saying these days) is how easy it is to customize. The ISE has its own object, $psISE. Open an ISE instance and take a look:

PS C:\> $psise

Let's look at Options. You can configure options to control settings, like the font. In my ISE profile script, I've set the font size to 16 using Consolas. This setting:

$psise.options.fontsize=16
$psise.options.fontname="Consolas"

is applied automatically when I start the ISE. You can use any installed font you want, although you'll get better-looking results if you stick to a fixed-width font. The font setting applies to all ISE panes, so even if it looks cool for the script editor, the output pane might not be so hot.

You might also want to change the background color of the script, output or command panes. When you look at the current settings, you'll see a value like #FFFFFFFF. However, you can use any color that you would use with Write-Host. Thus, to change the background color of the output panel is as easy as this:

$psise.options.OutputPaneBackgroundColor="Cyan"
$psise.options.OutputPaneTextBackgroundColor="Cyan"

You'll want to set both settings the same; otherwise, the text will look a little odd. Depending on the background color, you may want to adjust the text color:

$psise.options.OutputPaneForegroundColor="White"

After you make these changes, run CLS to refresh the pane. By the way, these settings will apply to any new tab you open as well.

One last change you might want to make is to specify the layout of the script pane. By default, it is at the top. But perhaps you'd like it to the right:

$psise.options.SelectedScriptPaneState="Right"

I know there are easy keyboard shortcuts and menu options to change this, but if you always want this setting, put it in your ISE profile.

Don't worry if you make a total mess of things. Close the ISE and restart it to revert to the original, default settings. When you have settings the way you like, then put the commands in your ISE profile script.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus

SharePoint Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.