Take your PowerShell to the next level with error handling and debugging
summary
Demos show how PowerShell actually surfaces errors: exploring $Error and $ErrorView modes, using $? and $ErrorActionPreference to turn non‑terminating failures into error action stop, and choosing between throw and Write-Error. Examples include catching specific exception types, collecting per‑item failures, and a live VSCode debugging session with breakpoints and step into of a module that gets fixed on the spot, proving the techniques work end‑to‑end.
AI-written summary · about
chapters (12)
- 0:00PowerShell error handling intro
- 1:56Common PowerShell errors
- 2:57$Error automatic variable
- 6:06Error details and properties
- 11:01Terminating vs non-terminating errors
- 12:24ErrorActionPreference impact
- 22:15Try-catch blocks
- 24:41Catching specific exceptions
- 30:23Throw vs Write-Error
- 34:14Per-item error handling
- 37:25Debugging with VS Code
- 43:48Q&A
related talks
48mUnexplained phenomena: powerful tricks you likely didn't know were even possible
47mTempting Fate: Patterns & practices for shareable scripts and functions
30mPokekYoke Mistake-Proofing your PowerShell scripts and functions
44mUsing Visual Studio Code as Your Default PowerShell Editor
37mUsing Windows PowerShell to create scripts your users want to use
45mInteractive Enhancements to PowerShell
17mPowerShell Events
01h 45mWriting Award Winning PowerShell Functions and Script Modules
