Skip to content

PowerShell Environment Customization

Implementation guide for enhancing the Windows terminal experience using PowerShell 7 and Oh My Posh.


1. Prerequisites

PowerShell 7+

Oh My Posh requires PowerShell 7+ (pwsh).

  1. Check Version:
$PSVersionTable.PSVersion
  1. Installation:
winget install Microsoft.PowerShell

Nerd Font (Iconography Support)

A Nerd Font is required for the correct rendering of icons and prompt separators.

  1. Font Installation:
winget install NerdFonts.CascadiaCode
  1. Terminal Configuration:
  2. Open Terminal Settings (Ctrl+,).
  3. Navigate to Profiles > Defaults > Appearance.
  4. Set Font face to CaskaydiaCove Nerd Font.

2. Oh My Posh Installation

Installation is managed via winget:

winget install JanDeDobbeleer.OhMyPosh

Verification:

oh-my-posh --version

3. Profile Configuration

PowerShell 7 utilizes a distinct profile path from legacy versions.

  1. Verify Profile Path:
$PROFILE
  1. Establish Profile File:
New-Item -ItemType File -Path $PROFILE -Force

4. Theme Management

Theme configuration files must be downloaded and stored locally.

  1. Create Configuration Directory:
mkdir $HOME\.config\oh-my-posh -Force
  1. Retrieve Configuration:
Invoke-WebRequest "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/emodipt-extend.omp.json" -OutFile "$HOME\.config\oh-my-posh\emodipt-extend.omp.json"

5. Activation

Initialize Oh My Posh within the PowerShell profile:

  1. Edit Profile:
notepad $PROFILE
  1. Append Initialization Command:
oh-my-posh init pwsh --config "$HOME\.config\oh-my-posh\emodipt-extend.omp.json" | Invoke-Expression
  1. Apply Changes:
. $PROFILE