Welcome to part three of taking command of Server 2008 with Windows PowerShell!
You’ve made it this far, so I’m assuming you enjoyed part one, where I showed you how to install and access PowerShell, and part two, where I explained PowerShell Cmdlets and PowerShell Providers.
If you missed those two articles, I would suggest reading them first — just to make sure you’ve got all the basics. Now let’s get started with an exercise in customizing your Windows PowerShell.

Windows PowerShell starts with the same look and feel of the Command Prompt, by default. Let’s make our first exercise of PowerShell power be to customize the PowerShell console.
The steps below will walk you through customizing the console options then saving those settings to be used every time PowerShell is launched.
$psui = (get-host).UI.RawUI
$psui.WindowTitle = “PowerShell PowerStation” $psui.BackGroundColor = “Blue” $psui.ForeGroundColor = “Yellow”
Note: The PowerShell console supports 16 colors. They are; Black, White, Blue, Cyan, Gray, Green, Magenta, Red, Yellow, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed and DarkYellow.
$psbs = $psui.BufferSize $psbs.Height = 3000 $psbs.Width = 120
notepad $profile
Click Ok to close the error and return to PowerShell to rectify the problem.
create-item $profile –type “file”
new-item $profile.SubString(0, $profile.LastIndexOfAny(“\”)) create-item $profile –type “file”
Note: If you have any experience with the .NET framework the first command of this step should look familiar. It utilizes the methods of the string object to parse the profile path out of the profile variable.
notepad $profile again$psui = (get-host).UI.RawUI $psbs = $psui.BufferSize $psui.WindowTitle = “PowerShell PowerStation” $psui.BackGroundColor = “Blue” $psui.ForeGroundColor = “Yellow” $psbs.Height = 3000 $psbs.Width = 120 cls
If script execution is enabled, when you launch PowerShell it will automatically start with the configuration set in the profile file. If not enabled, proceed to the next section for information on enabling it.
This example only covers customizing the PowerShell console window. Keep in mind that any variables or functions you define in the profile file will be automatically available for use when you launch PowerShell.
This is it for today! Next week we’ll go into PowerShell scripting — so don’t miss the last article of taking command of Server 2008 with Windows PowerShell. See you next week!
Jim Says:
February 27th, 2008 at 12:58 pm
I try to create the file, but I get an error that states the following:
PS Y:\> create-item $profile.SubString (0, $profile.LastIndexOfAny(”"))
The term ‘create-item’ is not recognized as a cmdlet, function, operable progra
m, or script file. Verify the term and try again.
At line:1 char:12
+ create-item
I have .Net 1.1, 2.0 and 3.0 installed. Any ideas?