Make PowerShell even more powerful and beautiful

In this article I show you how to get the most out of PowerShell by tuning it with the right modules and addons:

old (and a little ugly)new (and beautiful):

Prerequisites

To get a beautiful PowerShell like in the screenshot above, some things have to be prepared:

  • Install a beautiful font of your choice, in my examples I use CaskaydiaCove NF from a site like Nerdfonts or Cascadia Code. Important is that you use a font that supports Powerline Glyphs.
  • Install Git for Windows.
  • PSReadLine module version 2.2.0 or higher. I use the version beta4 – see below for installation instructions.

Install more PowerShell modules

With the prerequisites met, PowerShell 7 needs the necessary modules to be able to become beautiful:

Install-Module posh-git -Scope CurrentUser Install-Module oh-my-posh -Scope CurrentUser Install-Module PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
Code language: PowerShell (powershell)

The module oh-my-posh is the heart of the installation. Everything around is more like a beauty surgery ๐Ÿ™‚

The fonts from Cascadia Code didn’t work for me, so I installed a forked version from Nerd Fonts, called Caskaydia Cove Nerd Font Complete. The zip file contains the necessary ttf files to install this font to Windows:

Tweak Windows Terminal

Now it is already time for the final adjustments. Start Windows Terminal and go to settings (you could do all this also in the settings.json, but for simplicity I focus on the menus):

Go to the Profile that was created for pwsh (which is by the way the official abbreviation of PowerShell 7) – if there is none, create a new one by clicking Add a new profile and enter everything under General like I show here (don’t forget to save your settings – click the button on the lower right corner):

  • Name should be beautiful, so I call it PowerShell 7.2 instead of just PowerShell.
  • Command line must point to the PowerShell executable. The path should always be C:\Program Files\PowerShell\7\pwsh.exe (or put in the path if you installed it somewhere else).
  • Starting directory is the directory on the local drive that you want to start working inside. There is no best practice, for me it also differs from week to week. Sometimes it is the Dev-root folder, sometimes Documents, sometimes something else. The default is %USERPROFILE%.
  • For Icon I love to use the official PowerShell robot avatar. You can grab the official one from PowerShell/assets at master ยท PowerShell/PowerShell ยท GitHub. Here the icon avatar_128.svg. After downloaded, convert it to a png and enter in the icon path.
  • Tab title can be left blank. You can of course enter a custom text like pwsh7.2. I leave it blank, because I will shorten the ribbons later.

The result looks like this:

Next is the Menu Appearance:

  • Color scheme is depending on your preferences, take what you love most. You can preview your setting in the box right above the setting.
  • Font face is the most important settings to prevent ugly symbols in your new PowerShell look and feel. Here you must install a font that supports Powerline Glyphs. As mentioned I use CaskaydiaCove NF.
  • Font size and Font weight again depend on how you love most. Choose whatever you like.
  • Retro terminal effects is something I love and hate at the same time. But I use it often. It adds some sprite-effects like you had it in good-old-times with CRT displays. Use it for retro feeling, sometimes it is fun, sometimes it causes headache ๐Ÿ™‚ .
  • Automatically adjust lightness of indistinguishable text should always be on.
  • Cursor is (once again) a personal preference. Choose the one, you like most.
  • Background image is interesting if you want something really really really nerdy. Add a static picture or an animated gif as Terminal background.
  • Again, Text formatting and Transparency as well as Window depend on your preferences. Play around with them and look what happens.

The results of that menu:

Everything under Advanced is again – as you like it. Play around with it and see what happens. You may like it.

There are some final minor adjustments to make your Terminal the powerful PowerShell 7 command center:

  • Under Startup, set the Default profile to your newly created PowerShell 7.2 profile:
  • I changed the Default terminal application host to Windows Terminal Preview.
  • I recommend changing the When Terminal starts behaviour to Open windows from a previous session. That gives you quick access to where you left off your work the last time.
  • Under Interaction set Automatically copy selection to clipboard to On, that saves you a lot of time.
  • Also Remove trailing white-spaces in rectangular selection to On.
  • Under Appearance you can set Show acrylic in tab row for a more beautiful appearance of Windows Terminal.
  • The setting Tab width mode needs to be changed to Compact.

Admire your new PowerShell

With another command the predictive IntelliSense function (in the PSReadLine module) is woken up from its slumber:

Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Code language: PowerShell (powershell)

Next, have a look into your PowerShell modules directory into the oh-my-posh themes, usually it is:

%USERPROFILE%\Documents\PowerShell\Modules\oh-my-posh\themes
Code language: PowerShell (powershell)

Here you see a long list of themes from where you can choose:

You see, all themes are simply json files, so if you want to create your own – feel free ๐Ÿ™‚ All these themes can be set with one simple PowerShell command:

Set-PoshPrompt -Theme <strong><THEMENAME></strong>
Code language: PowerShell (powershell)

Play around with it and choose the style that you like most (once again). I show you some examples. First, my favourite one:

Set-PoshPrompt -Theme craver
Code language: PowerShell (powershell)

That is a clean look and feel with cool symbols:

Another very clean and beatiful one:

Set-PoshPrompt -Theme hunk
Code language: PowerShell (powershell)

2 more playful themes:

Set-PoshPrompt -Theme powerlevel10_rainbow Set-PoshPrompt -Theme powerlevel10k_rainbow
Code language: PowerShell (powershell)

You see, if you enter a non-existing profile, you fall back to the profile jandedobbeleer. If you read the links from this article carefully, you’ve learned that this guy is one of the oh-my-posh contributors (and not only that). So there is nothing you can do wrong here!

If you want a complete list of all themes and get an impression of the look and feel, execute this command:

Get-PoshThemes
Code language: PowerShell (powershell)

Have you noticed, that when you start typing a command now, PowerShell will offer you predictions from your command history? Have a look:

Use your arrow keys and select the command you want to execute again (or execute slightly different), hit enter and it:

Also noticed the clean tab bar? The current tab shows you the folder you are currently in, that’s why I chose the compact view inside Terminal with no labelling:

Well, that’s it! Enjoy your new PowerShell and impress your colleagues with the wonderful new colours on your Windows Terminal.

Published by Andreas

Founder of M365 Evangelists Cloud-Architect, Strategy Consultant, Consultant for Microsoft technologies, Graph API enthusiast, PowerShell enthusiast

One comment on “Make PowerShell even more powerful and beautiful”

Comments are closed.

%d bloggers like this: