PowerShell Error Handling: Terminating vs Non-Terminating Errors
Confusing terminating and non-terminating errors is the most common PowerShell error handling mistake. This post demystifies the difference and shows how each error type
Commands Tips
Confusing terminating and non-terminating errors is the most common PowerShell error handling mistake. This post demystifies the difference and shows how each error type
Graph API returns at most 999 items per page. Scripts that ignore @odata.nextLink silently miss records. This guide shows proper pagination with throttling-aware retry logic built
Throwing generic strings as errors makes debugging painful. Custom exception classes with typed properties let callers catch specific errors and extract structured failure
Transient failures kill long-running automation. This guide shows how to wrap any PowerShell command in a Retry-Command function with configurable backoff, jitter, and maximum
PowerShell scripts can create security vulnerabilities if written carelessly. Learn secure coding practices for credentials, injection, and execution policy.
Null pipeline results crash scripts unexpectedly. Learn defensive patterns for handling empty results with If checks, defaults, and null coalescing.
Write-Verbose adds optional diagnostic output that only shows when requested. Learn to add verbose messages to scripts and control them with -Verbose.
Measure-Command times any PowerShell code block. Learn to benchmark commands, compare two approaches, and find performance bottlenecks.
Use throw to signal unrecoverable errors in PowerShell functions. Learn to throw string messages, exceptions, and create custom exception types.
Start-Transcript captures everything your PowerShell session does to a log file. Learn to set it up in scripts and profiles for audit trails.