Prelude #2 Solution

Prelude #2 Solution

The last Chairmans’s challenge was based on a task you might have to face in real life – fixing someone else’s code. Although, that someone may be you! Of course it helps to know what should happen, which the Chairman so nicely provided. When run, the function should have produced output like this:

Expected output

A Solution

Without debating different techniques or commands, here is a solution for a working version of the function.

The Chairman will let go through the code and compare it to your solution.

A Pester Test

Of course, once modified an Iron Scripter will ensure that any future changes won’t break the code. For that, a Pester test is the best choice of defensive weapon. Here is a test file that is assumed to be in the same directory as the script file.

Creating a Pester test is as much of an art as anything so your solution will most likely vary. But when run you should get a result like this.

A Pester test result

If your Pester skills are soft, the Chairman recommends a hearty workout regimen. If you require assistance, seek out masters in the forums at In the mean time keep flexing your PowerShell skills as another Chairman’s prelude challenge looms.

Jeffery Hicks

Leave your message

%d bloggers like this: