Top 5 PowerShell Modules You Need to Know About

I have been using PowerShell for quite some years now, and over the years I have installed a lot of PowerShell modules. Most are purely functional, to connect to Exchange Online for example, but others are just really handy tools to have.

Even though there are a lot more PowerShell Modules that are worth to install, these are probably the best PowerShell modules that I used the most. If you have some good suggestion, make sure you let me know in the comments.

In this article, I will show you my Top 5 PowerShell modules that you should need to know about.

Oh-My-Posh

We of course have to start with one of the best PowerShell modules, Oh My Posh. This is a custom prompt engine that can be used with any shell and allows you to fully customize your terminal.

The latest version of Oh My Posh works with theme files, allowing you to easily create and share your custom theme. There is an extensive list of themes available, allowing you to easily pick one and get started.

best powershell module oh-my-posh

You can not only add colors to your terminal but also useful information, like the Git status, user information, or system information.

To get started with Oh My Posh, you can install it using the following command:

winget install JanDeDobbeleer.OhMyPosh -s winget

To fully use all the capabilities of Oh My Post, you will need to install a Nerd Font as well. Nerd Fonts are popular fonts where icons are added too. Installing one of the Nerd Fonts is pretty easy, simply type:

oh-my-posh font install

You can select one of the fonts to install. The recommended font is  Meslo LGM NF, but in the screenshot above I have used CaskaydiaCove Nerd Font. After you have installed the font, you will need to set it as your default font for your PowerShell sessions.

  • Open Windows Terminal
  • Click on the dropdown arrow and choose Settings
  • Select PowerShell in the sidebar, and open Appearance (all the way at the bottom)
  • Set the Font Face to your installed Nerd Font
Windows Terminal settings

With the fonts installed, we can select one of the Themes to use or as a starting point to customize. To view all the Themes, you can use the cmdlet Get-PoshThemes. This will show examples of all the themes in your console.

To install the theme, I recommend saving the JSON file locally. You can then enable the theme with:

oh-my-posh init pwsh --config 'd:\scripts\lazyadmin\lazyadmin.omp.json' | Invoke-Expression

Terminal Icons

The Terminal Icons PowerShell modules really accomplish the Oh My Post themes. Terminal Icons will add files and folder icons (and colors) in your shell. This really helps with quickly finding the right file or folder.

Terminal Icons PowerShell Module

Terminal Icons uses, just like Oh My Posh, a Nerd Font for all the icons. If you already have installed Oh My Posh, then you can simply install the Terminal Icons module with:

# Install the module
Install-Module -Name Terminal-Icons -Repository PSGallery

# Load the module - add this to your PowerShell Profile:
Import-Module -Name Terminal-Icons

If you are not using Oh My Posh, then make sure that you install a Nerd Font as well. You can checkout this guide for more information on how to get it to work in PowerShell.

ImportExcel – Import and Export Excel

When you have used PowerShell for quite sometime then you probably have created an report more then once. Most will use the Export-CSV cmdlet to export data from PowerShell and use in Excel. But there is an easier way to do this.

The ImportExcel module does not only allow you to import data from an Excel file, but it can also export to an Excel, with a fully functional table init as well. And it doesn’t stop there, charts, pivot tables, conditional formatting, is all possible.

Export Excel PowerShell Module

To quickly export your data to Excel and format it into a table, you can use the following command:

# First install the module
Install-Module -Name ImportExcel

# Get some data and export it to Excel with a formatted table
Get-EXOMailbox | Export-Excel -AutoSize -BoldTopRow -FreezeTopRow

PSWriteHtml – Export to HTML

Wether you are using PowerShell to automate tasks or to create reports, you often need to communicate the results. One way to do this is by sending an email from PowerShell with the results.

But a simple, plain text email isn’t going to it anymore. We want it nicely formatted, maybe a table in it, or some colors. That is where HTML comes in. Now you can write and format your own HTML, but the PowerShell module PSWriteHTML makes it a lot easier for you.

Another great feature of PSWriteHTML is that you can quickly export to results to an HTML file. So instead of Out-GridView, you can now use Out-HtmlView, which gives you an interactive HTML file. From the HTML view you can quickly export it again to CSV or PDF, or just share the HTML view if needed.

Export HTML PowerShell Module

To quickly generate a view like the example above, you can use the following PowerShell code:

# Install the module
Install-Module -Name PSWriteHTML

# Gather some data and output to HTML
Get-Exomailbox | Out-HtmlView

M365PSProfile – Keeping your Modules up-to-date

The last module that I wanted to share with your is the module M365PSProfile. To goal of this module is to simplify the installation and updating of all the Microsoft 365 related PowerShell modules.

Although the intention of the module is to only manage the Microsoft 365 modules, you can also use it to automatically install and keep other modules up to date.

The module will check all the listed modules when you open PowerShell and make sure that you have the latest version installed.

Top PowerShell Module M365PSProfile

To get started with the module, you will of course need to install it first. When done, you can add a list of modules in your PowerShell Profile that you want to keep up-to-date:

# Install the module
Install-Module -Name M365PSProfile -Scope CurrentUser

#Install or Updates the Modules in the Array
Install-M365Module -Modules @("ExchangeOnlineManagement","Microsoft.Online.SharePoint.PowerShell","PnP.PowerShell", "M365PSProfile","Microsoft.Graph","Microsoft.Graph.Beta","Terminal-Icons")

Wrapping Up

PowerShell modules are a great way to make your work a lot easier or working with PowerShell a lot nicer to look at. There are of course a lot more great PowerShell modules, these are only some of the best module in my opinion.

If you have a great PowerShell module that you highly recommend, then please let me know in the comments below!

2 thoughts on “Top 5 PowerShell Modules You Need to Know About”

  1. Great list, Ruud! 🙂
    I also love the “PSWindosUpdate” module, which allows you to perform and run Windows Update on your system(s) with a simple command.

Leave a Comment

8 Shares
Tweet
Pin8
Share
Share