PowerShell — Let’s make it personal

Kenneth Skodje
4 min readMar 25, 2021

We’ve installed git using PowerShell, but by default, it doesn’t really show us anything about the repository we’re in like Git Bash does.
This guide is for Windows PowerShell (Desktop)

It’s almost like we’re operating blind! Let’s fix that and make that PowerShell (I’ll call it PS from here on) look a bit more stylish! You should always determine for yourself that what you install is safe, that being said here is what I did 😁

Installing Modules

First, we need to install a couple of modules in PS:

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

You’ll get prompts you’ll need to accept to follow along.
If NuGet is not already installed you’ll be asked to do so 😀 NuGet is a package manager and is where we’ll get our modules from. Then commands above have to be run after NuGet is installed.

PS Profile

Once those modules are installed we’ll have to edit the profile settings of your PS. In the command-line type in notepad $PROFILE.
This opens up the profile file in notepad. If the file doesn’t exist you’ll get an alert asking if you want to create it, click Yes.

In the profile, we want to have it import the modules we just installed, in the file add:

Import-Module posh-git
Import-Module oh-my-posh

Save the file, then close and open a new PS window with administrator rights. Some windows installs might throw an error about the profile not being loaded due to it not being signed. If that is the case we need to change a setting to allow it to run unsigned content.

PowerShell’s execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. This feature helps prevent the execution of malicious scripts.

To check the current execution policy run Get-ExecutionPolicy and it might return AllSigned.
I opted to set it to have the remote ones still have to be signed, instead of leaving it all unsigned: Set-ExecutionPolicy RemoteSigned
This has to be run as an admin to be able to apply the new setting.

If you didn’t get an error you should be good to proceed.

Getting the Powerline Fonts

Close PS and reopen a window (doesn’t have to be admin this time) you won’t see much difference.
To be able to fully utilize the installed modules, we’ll need to have what’s called a “Powerline font”. A common one that is recommended is called “Cascadia Code PL”. I didn’t have much luck getting that to display properly, so I went with the one used in the Posh-Git docs: “Meslo”.

After downloading and extracting the files we need to install the required fonts. The zip file contains a lot of different font variants.
For the Cascadia Code, install CascadiaCodePL and CascadiaMonoPL.
For Meslo, install the two Windows Compatible Meslo LG L Regular Nerd Font Complete font files.

You can right-click the files and select install, or drag-and-drop into the Windows fonts directory.

Setting the PS Font

Click the PS icon in the very top left and select “Properties”.

Go to the Font tab, and find the font you chose to install in the list. I found 16 to be a good size for my taste.

Making it look nice

With the font installed and PS set to use, we’re ready to get the visual set up! 😃

In PS type in Get-PoshThemes, this will show a list with themes for you to chose from. The theme name is written out with the visual, and once you find one you like go back to our notepad window and add:

Set-PoshPrompt -Theme slim where “slim” is the name of the theme I went with.

That’s it! Your PowerShell should now be looking good and giving you some valuable information to boot!

Thanks for reading 🙂

--

--