How to Teach PowerShell to MSP Staff with PSKoans

Save to My DOJO

How to Teach PowerShell to MSP Staff with PSKoans

If you don’t use automation in your MSP then quite frankly, you’re doing it wrong. It’s pretty much the standard way of doing things these days and if you’re not doing it, your competitor is and will probably be providing a better service because of it. For MSPs, having an employee that is proficient with PowerShell is far more valuable than those who don’t. In fact, Jeffery Snover, the founder of PowerShell, predicts that in the future those who refuse to learn some sort of automation language like PowerShell will gradually become replaced by those who do. The skill set is that vital to a company. Imagine a scenario where we need to know if a specific event has occurred in the event logs on all client servers. If we had no one with PowerShell skills, we would have to manually dig through the event logs of each server and spend hours filtering through each one. On the other hand, if we have an employee who is adept at PowerShell they can write a script that will automatically dig through the event logs of each server and report back if the event exists. The benefit is just incomparable, which is why it is important for employees to be trained up on how to use PowerShell. Luckily, there are free community-driven tools like PSKoans that allow IT Pro’s to interactively learn and practice PowerShell to improve their skills and worth to the company.

What is PSKoans?

PSKoans is a project on GitHub started by Joel Sallow. It allows users to learn and practice PowerShell right through the console by providing “challenges” or “questions” that must be completed before progressing on to more challenging questions. The questions start off simple and eventually progress to intermediate and advanced PowerShell concepts. The module makes clever use of Pester, which is an automated unit test framework for PowerShell. It provides an interactive way to learn PowerShell by using PowerShell!

How to Install

You can literally start using PSKoans within 5 minutes. All you need to get started is a machine with PowerShell 5.1 or higher (PowerShell Core included). Just open up an Administrative PowerShell console of the required version and run the following command to install  the Pester module (if you already don’t have it installed):

Install-Module -Name Pester

After the Pester module is installed, we can now install the PSKoans module by using the same Administrative PowerShell console:

Install-Module -Name PSKoans

Now we are set to start using PSKoans. Simple, right? Because of the ease of installing PSKoans, it really makes this tool a “must have” tool for employees to use for “sharpening” their PowerShell skills.

How It Works

Now that we just installed PSKoans in under 5 minutes, let’s get started using it. To start using PSKoans, simply open up a PowerShell console and type:

Measure-Karma

Now, the journey begins! Because this is all done through the PowerShell console, it may be a little confusing at first, but let’s go over what we are looking at. The goal is to reach “Enlightenment” by completing each challenge. The first challenge is in the red text. The script-block shown is incorrect and we need to input the correct answer where the “_” symbol is. For the first question, the expected outcome is $true but we are currently getting null with this comparison script block. We need to edit the “AboutAssertions.Koans.ps1” file with the correct syntax and run a pester test against the koan to check if we pass the question: PSKoans PowerShell Let’s answer the first problem by running the following command to open up the .ps1 and edit line 27 to contain the proper code:

Measure-Karma -Meditate

The command checks if Visual Studio Code is in $env:Path and will open up VSCode to use for editing the .ps1 files: PSKoans Visual Studio Code Otherwise, it will simply open up the Koan’s folder directory in Explorer which is housed in UserFolder\PSKoans, in this case, we will just want to open up the .ps1 file with PowerShell ISE (or even better, install Visual Studio Code, its FREE!): To answer the question, we replace the “_”  on line 27 with “$true” and save the file: To check out the answer we re-run Measure-Karma since we entered the correct answer we are now on to a new “Koan”, also we can see in the Path Thus Far section that we have 1 out of 246 questions correct now: Now, on to the next Koan. Check out the GIF below which demonstrates me answering the next Koan:

Want to learn more about how PowerShell can help you? Read on

Building PowerShell Tools for MSPs series

Further PowerShell reading

Altaro O365 Backup for MSPs
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

6 thoughts on "How to Teach PowerShell to MSP Staff with PSKoans"

Leave a comment

Your email address will not be published.