Modifying Your PowerShell User Profile

 

Most people including myself are never quite totally happy with the defaults for anything provided to us free of charge by the wonderful folks at Microsoft. This includes the Command prompt (CMD) the Services for UNIX (SFU) and the Windows PowerShell consoles.

 

Those of you who like to explore, tweak and tinker with such things have a wealth of items available to us to use to modify the PowerShell console. Many of these are available to us because the .Net framework is used to support the PowerShell environment. If you are familiar with the C# programming language or with .Net programming you will be proficient at such modifications in no time at all.

 

I am still new to PowerShell programming as most of us are but the urge to make the PowerShell console all mine is to strong to resist. As a result I have modified my user profile from the title screen to the text and background colors. I even added a Cmdlet alias as well as added a welcome message and changed the prompt to suit my personal needs.

 

I urge those of you who are sad little individuals like me to customize your PowerShell console. To get those of you who are still new to the PowerShell environment like I am started I will share with those who are interested my PowerShell user profile below. You can use in whole or in part to begin your own customizations.

 

Microsoft.PowerShell_Profile:

 

# Set Alias Commands

Set-Alias List Get-ChildItem

 

# Set Console Window Colors

$Host.Ui.RawUi.BackGroundColor = "Black"

$Host.Ui.RawUi.ForeGroundColor = "Green"

 

# Set TitleBar Text

$Host.Ui.RawUI.WindowTitle = "My PowerShell Console"

 

# Clear The Screen

Clear

 

# Welcome Message

Write-Host $Env:ComputerName "Welcomes You To The Windows PowerShell Console" -Fore Cyan

Write-Host ""

 

# Date

Write-Host "Today Is:" -Fore Magenta

Get-Date -DisplayHint Date

 

# Set Prompt Options

Function Prompt

{Write-Host ("MPS:") -NoNewLine

Return " "

}

 

 

Published Sunday, January 07, 2007 8:03 AM by dhite
Filed under:

Comments

No Comments