Custom PowerShell Prompt

About a week ago, I participated in the Nordic Virtual Summit, and caught quite a few good presentations from leading tech personalities. One of them was Jan Egil Ring from Crayon, on Azure Functions in a Hybrid world.

The presentation and demo in itself was interesting, but it motivated me to try again with a customized PowerShell Prompt. Earlier I have done some half-hearted attempts at doing this, but I haven’t dedicated much time for this purpose. Therefore I never got around to finishing it.

Cue Oh my Posh 3!

The express install list for Windows:

  1. Download and install a PowerLine capable font.
  2. Install Oh my Posh, Posh-Git and PSReadline (for PowerShell 7).
  3. Set Prompt theme.
  4. (Optional) Set default prompt with PowerShell profile.

You can see the steps in more detail here. Also a Microsoft guide here. I am currently using the Paradox-theme, but also like the Agnoster and Agnosterplus. Paradox-theme was likely my initial choice because the Microsoft guide is using it in the example. More font demos can be found here.

The crucial step that I did not pay enough attention to last time, was the fonts. More importantly the “PowerLine Capable Font”. Glyphs and special characters in my console have never been an issue, until I wanted to try the customized prompt. The fonts at Nerd Fonts have been modified to include certain glyphs.

I installed the Caskaydia Cove Nerd Font.

Please visit the web page to preview and install the font. Remember to install for all users, to prevent any issues with displaying the font in terminals.

The important part is to get font name correct in your Windows Terminal, and other places of use. 

Side note: If you have not installed Windows Terminal yet, I recommend you check it out. It is great for PowerShell, Cmd, WSL, ++. You can get it from the Microsoft Store, or from other sources.

You also need to explicitly set the font in VSCode:

Side note: If you have not installed Visual Studio Code yet, I suggest you check it out. It is great for all things code: ARM, Bicep, Terraform, PowerShell, MarkDown, ++. Extension support is great!

If you installed the font I recommended above, Caskaydia Cove, you will need to use this fontFace: “CaskaydiaCove NF” for your windows terminal settings.json:

Note the font name . This is the same as it is called in windows font settings:

In PowerShell 7 I still could not get this to work. The font name is correct, the font is accessible, locale is 65001-UTF8, and some of the glyphs work. Still some empty squares where glyphs are supposed to be, but I only use VSCode or Windows Terminal anyway, so no biggie.

It really is worth it getting the more visually pleasing prompt, and it does provide added value with more relevant information than just the working directory.

2 Replies to “Custom PowerShell Prompt”

    1. Actually, I know too little about Bicep to judge it entirely. I have used it for some small tasks, but not for large deployments. All simplification of Azure infrastructure code is welcome. I really like the simplicity for authoring Bicep files, and I like the fact that you now can send Bicep files directly to Azure Resource Manager. That said, I am willing to hazard a guess it will pick a fight with Terraform/Pulumi/etc. at some point. MS is very adamant they are not competing with Terraform, but it is only logical to implement what-if functionality in Bicep like in ARM deployments. From there, I think the way is short to flesh out the functionality and start the journey towards a new deployment tool for IaC. ATM I am doing mostly Terraform, and will be for quite some time. It is important to learn Bicep, and use it, so you are prepared for whatever MS has planned for this tool. Just my two cents.

Leave a Reply to Jostein Cancel reply

Your email address will not be published.

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