r/PowerShell • u/KevMar Community Blogger • 1d ago
News Why developers hate PowerShell
https://powershellexplained.com/2026-11-24-why-developers-hate-PowerShell/?utm_medium=post&utm_content=rpowershell&utm_source=redditThis is a post that I have been thinking about writing for a very long time now. I find that developers struggle with PowerShell in a very different way that the sysadmin learning to automate. They bring intuitions and assumptions with them from other languages that catch them off guard when they skip over the documentation. In this article I try to capture some of those experiences and misunderstandings.
I cover a lot of ground in this one: running scripts, execution policy, aliases, objects and formatting, calling functions, output and return values, unrolling, operators, case sensitivity, type conversion, truthiness, strings, scope, automatic variables, paths, encoding, errors, native commands, and classes.
While this one is targeting Software Engineers more then Systems Engineers, I would still appreciate your feedback and stories of your own frustrating experiences.
Thank you, -Kevin
View all comments
Show parent comment
4
u/surfingoldelephant 23h ago edited 5h ago
Because
[ordered]is special-cased in the parser (similarly with[pscustomobject]and[ref]).There's a semantic check that prevents anything other than a hash table literal following it because it's not a real type in Windows PowerShell. It's kinda like an attribute (but not really) that tells PS to produce a case-insensitive
Collections.Specialized.OrderedDictionaryinstance. That dictionary type by default is case-sensitive.[ordered]was added as type accelerator in PS v7, hence you can do[ordered]::new()in that version, which is the exact same as[Collections.Specialized.OrderedDictionary]::new(). But with conversion expressions, you can still only do[ordered] @{}because the semantic check that prevents anything else is still in place.Also, side note, there are slightly different conversion rules depending on whether you type-constrain or cast. For example,
$var = [bool] ''is fine, but[bool] $var = ''is not. Something to watch out for if you type-constrain a lot.