PowerShell MVP and prodigious PowerShell blogger Keith Hill has converted his very popular Effective PowerShell blog series into a FREE Ebook. You can download it HERE.
Table of Contents Introduction ...............................................................................................................................................................1 Item 1: Four Cmdlets that are the Keys to Discovery within PowerShell ..................................................................1 Key #1: Get-Command ..........................................................................................................................................1 Key #2: Get-Help ...................................................................................................................................................2 Key #3: Get-Member ............................................................................................................................................5 Key #4: Get-PSDrive ..............................................................................................................................................6 PowerShell 2.0 Update ..........................................................................................................................................7 Item 2: Understanding Output .................................................................................................................................8 Output is Always a .NET Object ..............................................................................................................................8 Function Output Consists of Everything That Isn't Captured .................................................................................9 Other Types of Output That Can't Be Captured .................................................................................................. 11 Item 3: Know What Objects Are Flowing Down the Pipeline ................................................................................. 12 Item 4: Output Cardinality - Scalars, Collections and Empty Sets - Oh My! ........................................................... 15 Working with Scalars .......................................................................................................................................... 15 Working with Collections ................................................................................................................................... 16 Working with Empty Sets ................................................................................................................................... 17 Item 5: Use the Objects, Luke. Use the Objects! ................................................................................................... 19 Item 6: Know Your Output Formatters ................................................................................................................... 22 Item 7: Understanding PowerShell Parsing Modes ................................................................................................ 31 Item 8: Understanding ByPropertyName Pipeline Bound Parameters .................................................................. 35 Item 9: Understanding ByValue Pipeline Bound Parameters ................................................................................. 38 Item 10: Regular Expressions - One of the Power Tools in PowerShell ................................................................. 42 PowerShell 2.0 Update ....................................................................................................................................... 43 Item 11: Comparing Arrays .................................................................................................................................... 43 Item 12: Use Set-PSDebug -Strict In Your Scripts - Religiously ............................................................................... 45 PowerShell 2.0 Update ....................................................................................................................................... 47 Item 13: Commenting Out Lines in a Script File ..................................................................................................... 47 PowerShell 2.0 Update ....................................................................................................................................... 48