r/PowerShell • Community Blogger • 14h ago

News Why developers hate PowerShell

https://powershellexplained.com/2026-11-24-why-developers-hate-PowerShell/?utm_medium=post&utm_content=rpowershell&utm_source=reddit

This 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

223 Upvotes

70 comments sorted by

View all comments

1

u/wonkifier 7h ago

One other one that has eaten so much of my time over the years until I figured out how to make it work

Adding an index entry to a list. This one works:

GOOD:

 $i=1;Get-ChildItem | Select-Object @{Name="index"; Expression={($script:i++)}}, Name, PSIsContainer, Length

Note the () around the increment

--

Without that, the index is empty.

BAD:

$i=1; Get-ChildItem | Select-Object @{Name="index"; Expression={$script:i++}}, Name, PSIsContainer, Length

--

Similarly, without the scoping, it doesn't work either, even with the parens. This just shows "1" for each row

BAD:

$i=1; Get-ChildItem | Select-Object @{Name="index"; Expression={($i++)}}, Name, PSIsContainer, Length

--

Remove them both, and you're back to empty

BAD:

$i=1; Get-ChildItem | Select-Object @{Name="index"; Expression={($i++}}, Name, PSIsContainer, Length

--

It's extremely unintuitive