Blog Post

PowerShell Tip – Custom windows for different tasks.

,

G’day

There seems to be a lot of articles around at the moment concerning the use of PowerShell.

I think this is great and I’m currently attempting to write a Powershell script for all of the activities that I perform daily on my databases.

However, anybody who has more than a few scripting windows open at time, will soon notice that it becomes quite a chore identifying what has been running in that window (or perhaps what is still running.)

One simple way that I’ve recently noticed people doing is to customize the Powershell Session, changing the foreground and background colours as well as the title of the window.

For example, say we have a window that we are just using to preform backups in.

We might change the title of the window to “Server backups” and possibly the background colour to blue and the text colour to white (or whatever floats your boat.)

There’s a whole heap of customizations that can be made.

Here’s a small sample to illustrate what I mean with a script that changes a few properties of the window.

$a = (Get-Host).UI.RawUI

$a.BackgroundColor = “Blue”

$a.ForegroundColor = “White”

$a.WindowTitle = “Server Backups”

CLS

Quick visual indicators are always good.

This may be a simple tip, but I’ve found that it works well for me, and I hope it helps somebody else out. I’d be interested to hear if you like it.

cheers

Martin.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating