PowerShell Null Coalescing and Null Conditional Operators
PowerShell 7.1 added ?? and ?. operators that eliminate verbose null checks. This post shows practical patterns and the subtle differences from C# equivalents worth knowing.
Commands Tips
PowerShell 7.1 added ?? and ?. operators that eliminate verbose null checks. This post shows practical patterns and the subtle differences from C# equivalents worth knowing.
Get-Random generates numbers and picks random items from arrays in PowerShell. Learn range, seed, shuffle, and when to use cryptographic randomness.
Time zone bugs cause midnight scripts to behave unexpectedly. Learn to work with UTC, convert time zones, and write timezone-safe PowerShell scripts.
PowerShell handles XML natively via the [xml] type accelerator. Learn to load, navigate, modify, and save XML config files and data files.
Hashtables and PSCustomObjects both store named data in PowerShell. Learn the real differences in performance, pipeline behavior, and best use cases.
Never store passwords as plain text in scripts. Learn SecureString, PSCredential, and encrypted password file patterns for secure automation.
Get-Date provides the current date and time in PowerShell. Learn to format, add days, compare dates, and use DateTime in scripts.
Enums enforce valid values in PowerShell scripts. Learn to use built-in .NET enums, define custom enums, and validate parameters with them.
Null values cause unexpected errors in scripts. Learn to check for null, use null coalescing in PowerShell 7, and handle missing data safely.
PowerShell’s flexible typing can cause silent bugs. Learn to explicitly cast types, use the safe -as operator, and convert dates and numbers.