Pestering your Script

From Learn PowerShell Scripting in a Month of Lunches by Don Jones and Jeffery Hicks

As we move into a DevOps-y world, one of the things you’ll need to start thinking about is how you’ll test your scripts. Here’s the deal: nobody likes a broken script in production. And although you might run a few tests on your script, you – or someone else – might also modify your script at some point, necessitating a re-test. Or, you might find some odd condition under which your script fails – well, you certainly don’t want to forget to test that condition again in the future, do you? In this article, we’ll talk about automated unit testing for PowerShell scripts.

The Many Forms of Scripting: which to use

From Learn PowerShell Scripting in a Month of Lunches by Don Jones and Jeffery Hicks

This article is about learning to draw the line between two equally important kinds of script – tools and controllers. Specific techniques are suitable for tools, and different ones are suitable for controllers. Each set of techniques is designed to reduce your workload, debugging, maintenance, and increase readability and reusability. Knowing which kind of script that you’re writing helps direct you to the right set of techniques, and this is the key to being a successful scripter and toolmaker!

Always Design First (with PowerShell)

From Learn PowerShell Scripting in a Month of Lunches by Don Jones and Jeffery Hicks

Before you sit down and start coding up a function or a class, you need to do some thinking about its design. We frequently see toolmaking newcomers charge into their code, and before long they’ve made some monstrosity which is harder to work with than it should be. In this article we’re going to lay out some of the core PowerShell tool design principles, and help you stay on the path of Toolmaking Righteousness. We’ll include some concrete examples.

Parameter Binding and the PowerShell Pipeline


By Don Jones and Jeffery Hicks

WWPD: What would PowerShell do?

From Learn PowerShell Scripting in a Month of Lunches by Don Jones and Jeffery Hicks

We see a lot of people jump into PowerShell scripting much the same way they’d jump into batch files, VBScript, or Python. Nothing wrong with that – PowerShell is able to accommodate a lot of different styles and approaches, but you end up working harder than necessary unless you take a minute to understand how PowerShell really wants to work. We believe that toolmaking is the real way to use PowerShell.

Free eBook: Exploring PowerShell Automation


Chapters selected by Richard Siddaway

PowerShell V4: Where() and ForEach() Methods

By Richard Siddaway and Bruce Payette

PowerShell V4 introduced two new operators for working with collections, Where() and ForEach(). In this article, excerpted from Windows PowerShell in Action, Third Edition, we’ll tell you about them.

Extensions: Finding and Adding Modules

There are two kinds of extension for PowerShell v2: modules and snapins. In this article, based on chapter 5 of Learn Windows PowerShell in a Month of Lunches, author Don Jones explains how to find and add modules.

Extensions: Finding and Adding Modules (PDF)

Conquering administrative challenges with PowerShell and WMI

This article is taken from the book PowerShell and WMI from Manning Publications. The author explains how PowerShell and WMI provide a set of tested techniques that will enable you to administer your Windows environment in a faster and easier way.

Conquering administrative challenges with PowerShell and WMI (PDF)

Implementing Multi-machine Monitoring

By Bruce Payette
This article is taken from the book Windows PowerShell in Action, Second Edition. In this article, the author builds a solution for multi-machine monitoring. First, he teaches how to write a script against a single host, and then against a list of machines. Next, he describes throttling, a method of limiting the amount of resources that an activity can consume at one time. Lastly, the author shows how adding parameters can increase the flexibility of this resource management tool.

Implementing Multi-machine Monitoring (PDF)

© 2018 Manning — Design Credits