Veteran PowerShell experts and authors Don Jones and Jeffery Hicks bring you an all-new, "Agile-published" book on PowerShell Scripting and "Toolmaking." Written in their inimitable, approachable style with plenty of examples, this book focuses on an all-new narrative based on their teaching experiences since 2010. You'll not only learn "how to script" in PowerShell, you'll learn the far more important patterns and practices that will enable you to create reusable tools that look and work like native PowerShell commands. You'll also learn a world of related topics, including how to add database access to your tools, how to publish to public and private repositories, and even an introduction to key topics like Pester testing.
Thousands of IT professionals have, after experiencing Don & Jeff's classes and books, remarked that, "now I need to go home and rewrite everything I've done!" That's what this book will do for you: change the way you think about coding in PowerShell. You'll find yourself producing more efficient, more reusable tools, more easily and more quickly. You'll cement a deep understanding of not only how PowerShell works, but why it works that way, helping you make better script design decisions, and helping you execute better PowerShell tools from now on.
Author(s): Don Jones; Jeff Hicks
Edition: Forever Edition [2020-06-30]
Publisher: Leanpub
Year: 2020
Language: English
Pages: 519
About This Book
Dedication
Acknowledgements
About the Authors
Foreword
Feedback
Introduction
A Note on Code Listings
Lab Setup
Part 1: Review PowerShell Toolmaking
Functions, the Right Way
PowerShell Tool Design
Start with a Command
Build a Basic Function and Module
Adding CmdletBinding and Parameterizing
Emitting Objects as Output
An Interlude: Changing Your Approach
Using Verbose, Warning, and Informational Output
Comment-Based Help
Handling Errors
Basic Debugging
Verify Yourself
Part 2: Professional-Grade Toolmaking
Going Deeper with Parameters
Advanced Function Tips and Tricks
Dynamic Parameters
Writing Full Help
Unit Testing Your Code
Extending Output Types
Advanced Debugging
Command Tracing
Analyzing Your Script
Controlling Your Source
Converting a Function to a Class
Publishing Your Tools
Part 3: Controller Scripts and Delegated Administration
Basic Controllers: Automation Scripts and Menus
Graphical Controllers in WPF
Proxy Functions
Just Enough Administration: A Primer
PowerShell in ASP.NET: A Primer
Part 4: The Data Connection
Working with SQL Server Data
Working with XML Data
Working with JSON Data
Working With CSV Data
Part 5: Seriously Advanced Toolmaking
Tools for Toolmaking
Measuring Tool Performance
PowerShell Workflows: A Primer
Globalizing Your Tools
Using “Raw” .NET Framework
Scripting at Scale
Scaffolding a Project with Plaster
Adding Auto Completion
Adding Custom Formatting
Adding Logging
Toolmaking Tips and Tricks
Part 6: Pester
Why Pester Matters
Core Pester Concepts
Writing Testable Code
What to Test
Describe Blocks
Context Blocks
It Blocks
Should and Assertions
Mocks
Pester’s TESTDRIVE
Pester for Infrastructure Validation
Measuring Code Coverage
Test-Driven Development
Part 7: PowerShell 7 Scripting
PowerShell 7 Scripting Features
Cross Platform Scripting
Wish List
Release Notes