The Pester Book Chapter Review (1)

Table of ContentsMy Introduction

Pester. Have you heard about it? I should hope you’ve at least, heard of it.

I know the exact moment I realized that I needed Pester, and decided I would learn it backwards and forwards, once for all. You’ll realize the moment too, if you haven’t already. Before that, providing it hasn’t happened, you need to know a little about what Pester is and what it does, so that when the day comes, you’ll have enough introductory information to now know that it’s a requirement in your life. It happens.

I was working an AWS Windows project that hadn’t yet included Active Directory. In this project and its sub projects, I was essentially creating and configuring Windows workgroup computers. If you consider that the project required a good deal of security and that we didn’t have an Active Directory environment to leverage, you can imagine that I had several settings to edit, in order to secure our machines.

The environments were built using AWS CloudFormation and a couple PowerShell modules that often included several functions. For each sub project, I built a new stack and waited for my instances and other resources to become available. When my instances were completed, I’d jump on them via Remote Desktop and start poking around. Were my users created? Was my SSL certificate for Remote Desktop in place? Were my PowerShell modules in place? Were my software installers in place? Were all the Registry settings applied? I was doing a “quick” and manual visual spot check to make sure my systems were configured correctly. Me, someone that’s dedicated to automation, was doing these things manually. I’d literally remotely connect to an instance, open the PowerShell ConsoleHost, and enter a string of commands that looked like this:

PS > regedit; certlm.msc; compmgmt.msc; ii 'c:\Program Files\WindowsPowerShell\Modules'

The above commands would open up the different graphical utilities that I needed, in order to ensure my automation had run successfully. I could check my registry settings, I could check to see if my certificate was imported, I could check to see if my users were created, and I could check to see if my PowerShell modules were in place. I was doing this manually, even when I knew there was a better way.

I repeatedly thought, I should write a function to do these checks for me. But why write another function? Why not use what’s already been built-in to test my system? Why not improve my project and get more experience with Pester at the same time?

Well, I did. After all those manual checks on my instances, I was just thrilled to see all those green lines produced by Pester, taking milliseconds of time, to remind me of all the time I had already wasted. But I’m okay with it now, as this project presented me an opportunity to really begin to appreciate and utilize Pester. And in that, the time and effort of Adam Bertram.

Follow along as I read Adam’s The Pester Book published on Leanpub.com. I’m not going to teach you Pester per se, but I’m going to write about as though we’re reading the same book together — Adam’s book — and share my thoughts as I do. You ought to get a copy and follow long; we’ll learn this better together. For the foreseeable future, let’s make this blog a weekly review of what we’ve read, so you and I can potentially get more out of our reading. Maybe we’ll do more than a single chapter per week — we’ll see. I’ll be back soon with the first installment; therefore, you should get your copy of The Pester Book today!

Leave a Reply

Your email address will not be published. Required fields are marked *