Tempting Fate: Patterns & practices for shareable scripts and functions
summary
Concrete rules for shareable PowerShell code: always wrap Begin/Process/End blocks in try/catch around Begin/Process/End blocks and rethrow by default so callers can handle errors; log rich data with write-information that logs full exception objects so logs include stack and can be exported (Export-Clixml) and rehydrated; design parameter names to match pipeline property names (use aliases), prefer specific names like FilePath or TimeoutSeconds, and structure modules so pipeline input hits Process for performance.
AI-written summary · about
chapters (21)
- 0:00Intro
- 0:15Who am I
- 1:50What makes code shareable
- 6:00Error handling
- 7:38Trycatch
- 14:53Logging
- 20:46Summary
- 24:13Interfaces
- 25:11Brainstorming
- 26:12Writing examples
- 26:53Writing synopsis
- 28:24Tests
- 29:40Parameters
- 33:51Parameter Names
- 35:42Distinct
- 36:53Consistency
- 37:55Writing a process block
- 39:16Optimizing the process block
- 40:30Customizing output
- 42:04PS typing
- 42:36Dash Computing vs ComputerName
related talks
45mBullet-proofing Patterns & Practices
30mPokekYoke Mistake-Proofing your PowerShell scripts and functions
01h 45mWriting Award Winning PowerShell Functions and Script Modules
48mUnexplained phenomena: powerful tricks you likely didn't know were even possible
51mDon't do that, do this instead: PowerShell worst practices and..
52mPowerShell Module Design Rules (and When to Bend Them)
47mThe Human Side of PowerShell Scripting
01h 37mMore Game Breaking PowerShell
