Switch statements in PowerShell are like the Swiss Army knife of control flow – they can handle multiple conditions with the elegance of a ballet dancer and the efficiency of a German engineer. Think of them as the sophisticated cousin of the if-else statement who went to college, learned multiple languages, and now works at […]
Enums in PowerShell provide a clean way to work with strongly typed values, improving readability, maintainability, and reducing errors. By grouping related constants under a single type, you avoid magic numbers and hardcoded strings, gain autocompletion, and enable built-in validation in functions. Whether you use native syntax, Add-Type with C#, or classes with static properties, enums make your scripts more robust and easier to manage.
Dot sourcing is like the PowerShell equivalent of borrowing your neighbor’s tools – except instead of forgetting to return them, you get to keep everything permanently in your workspace. It’s a powerful feature that allows you to run a script in the current scope rather than in a new, child scope, making all its goodies […]
Hashtables and PSCustomObjects may look similar in PowerShell, but they serve very different purposes. This post explores their syntax, performance, and practical use cases, helping you choose the right structure for dynamic data handling or clean output formatting.
Introduction As briefly mentioned in the blog post Mastering PowerShell’s Comparison Operators, PowerShell allows you to match patterns using different operators. In this post, I’ll dive deeper into the differences between two commonly used options: -like and -match. At first glance, they may seem interchangeable, but they’re not. Before we get into the details of […]
PowerShell 7.4 introduces a subtle but impactful change: the default encoding for HTTP requests is now UTF-8 instead of ASCII. This shift can cause unexpected issues when working with the Microsoft Graph API, particularly during .intunewin file commits in Intune. In this post, I explain the root cause, share workarounds, and offer practical solutions to keep your automation workflows running smoothly.