#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Customize PowerShell’s TitleBar

Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.

Some of the first things I ask a user when assisting with PowerShell are:

  • Are you running the 32-bit or 64-bit version of PowerShell?
  • Are you running as an Administrator?
  • Which version of the PWPS_DAB do you have installed?

The following is a simple way to always have that information readily available.

Why not put it in the PowerShell titlebar?

You can see in the image below that each session is running as an Administrator, you have the version information for both PowerShell and the PWPS_DAB module installed.


To implement this, simply copy and paste the code snippet into your PowerShell profile.

Enter $profile.CurrentUserAllHosts within PowerShell to determine where your profile is located.

Example: C:\Users\brian.flaherty\Documents\WindowsPowerShell\profile.ps1

Code Snippet:

$RunningAs = [string]::Empty
$ProcessType = [string]::Empty
$PWPS_DAB_Version = [string]::Empty
$Admin = 'Administrator'
$HostName = $Host.Name.Substring(0, $Host.Name.IndexOf('Host')).Trim()

try {
if(Get-Module -Name 'pwps_dab' -ListAvailable) {

$CurrentVersion = (Get-Module -Name PWPS_DAB -ListAvailable)[0].Version.ToString()
$AvailableVersion = (Find-Module -Name 'pwps_dab').Version.ToString()

if(-not ($CurrentVersion.Equals($AvailableVersion))){
Write-Host 'There is a new version of the PWPS_DAB module available.'
$Result = Read-Host -Prompt 'Would you like to install it (y/n)?'
if($result.ToLower().Equals('y')) {
Install-Module -Name 'PWPS_DAB' -Repository 'PSGallery' -Force
$CurrentVersion = (Get-Module -Name PWPS_DAB -ListAvailable)[0].Version.ToString()

$PWPS_DAB_Version =" : PWPS_DAB Version: {0}" -f $CurrentVersion
} else {
Write-Warning 'PWPS_DAB module not installed.'
$result = Read-Host -Prompt 'Would you like to install the PWPS_DAB Module (y/n)?'
if($result.ToLower().Equals('y')) {
Install-Module -Name 'PWPS_DAB' -Repository 'PSGallery' -Force

if(-not ([System.Environment]::Is64BitProcess)) {
$ProcessType = ' (x86) '

# Are we running as Administrator?
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] $Admin)) {
$RunningAs = $Admin 
} else {
Write-Warning 'You are NOT running As Administrator!'

$Host.UI.RawUI.WindowTitle = "{0}: {1}{2} Version: {3}{4}" -f $RunningAs, $HostName, $ProcessType, $PSVersionTable['PSVersion'].ToString(), $PWPS_DAB_Version

} catch {
# Press any key to continue . . .
Write-Error 'Could not determine environment of PowerShell!'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.