Is there a way to change the PowerShell banner message?

3

1

Every time you start PowerShell (unless using the -nologo parameter), a Microsoft copyright notice message appears.

Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

Is there a way to modify this banner to add more interesting and/or useful information (e.g.: PowerShell version, current system date/time, "Greetings Professor Falken. Shall we play a game?", etc.)?

Iszi

Posted 2013-09-15T17:28:36.303

Reputation: 11 686

Answers

6

I don't think you can modify the above text, but you can have it automatically print your own text too, you would just need to edit your powershell shortcut to always launch with -nologo

The way you do this is by editing your Power Shell Profile

To find your profile you simply just type $profile and hit return and it will show you the full path to the profile script. The profile may or may not exist, but it will return the path that power shell will attempt to look in first.

The command Test-Path $profile will tell you if the profile exists or not.

Once you create the profile script at the correct location it will run everything in the script every time you start up power shell. So to get what you wanted you would need to create a profile with the following

Write-Host 'Powershell' $PsVersionTable.PSVersion '-' (Get-date)
Write-Host 'Greetings Professor Falken. Shall we play a game?'
Write-Host ''

However, you may hit a snag if you just do that, you will likely get a error with something similar the following

File C:\Users\Scott\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because the execution
of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:2
+ . <<<<  'C:\Users\Tami\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

If you get an error like that read the help file by typing get-help about_signing so you can either set it to open unsigned scripts1 or change the setting to only allow signed scripts and sign the script yourself when you are done.

Once you get it all working every time you start powershell with -nologo it will look like

Powershell 2.0 - 9/15/2013 2:41:42 PM
Greetings Professor Falken. Shall we play a game?

PS C:\Users\Scott> 

1: I set my machine to RemoteSigned which only requires a signature if the script has the "from another computer" flag set.

Scott Chamberlain

Posted 2013-09-15T17:28:36.303

Reputation: 28 923