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
49
u/aguerooo_9320 23h ago
Top quality u/KevMar, I'm hoping more people will read beyond the title and a quick diagonal glance, to understand that this is actually a helpful article for a developer starting to work with Powershell, to ease their experience.
20
u/kagato87 20h ago
I've converted my dev team. They've learned that, while.it is an interpreted language, it's also a fully capable object oriented language. Like a JIT language except it doesn't actually need any compile at all, and is crazy easy to debug.
14
u/Solonotix 23h ago
I hit almost every single thing you've mentioned, lol. As a developer on Windows, PowerShell is my go-to for scripted actions, and I have been bitten so many times by these various gotchas. I like to think I'm on the other side of this bell-curve, though, where I'm now starting to use these eccentricities rather than being caught unawares.
For instance, the gotcha about multiple return values in a function scope. That's just how pipelines work. You want to make a lazy-ish pipeline? Just allow a value to be returned without a variable to capture it (and no
returnkeyword). On the caller side, they can abort that execution with... | Select-Object -First ...and you didn't even need to account for it.The exception there, of course, being that you might have a disposable resource like an open file or connection. The gotcha I then hit (feel free to add this to your article) was learning that the
End { ... }block does not work like you might expect, since internally PowerShell is calling the blocksBegin { ... }thenProcess { ... }thenEnd { ... }with an implicitEnd { ... }block if you omit all of them. Side note, the special function keywordFilterhas an implicitProcess { ... }block instead. Anyway, all of that to say that a disposable resource can now be safely handled in aClean { ... }block which will always execute upon exit, even when something else aborts the processing of a function/command.This was a really big lesson for me when I was trying to do a TestRail upgrade (that royally sucked). Had to do a lot of database calls and relate it back to the file system, and I had already uninstalled all of the crap needed to complete their install instructions (e.g. Python 2.7, JDK 8). So, I dropped down into the .NET side of things and got into using
[System.Data.SqlClient]. My first hitch was that lingering open cursor from one function call, and it was going to prevent subsequent queries from being run because the result set hadn't been disposed of. TheClean { ... }block was only added in PowerShell v7.3 so I shudder to think what the code would have looked like prior to this. I probably would have dropped into a C# class file and imported it withAdd-Typebut that begets its own realm of troubles lol23
u/AngryPets 23h ago
Kevin - this is GOOD STUFF(TM).
Initially, my thought was that a better title might be "Common Pitfalls for Developers Learning PowerShell" or ... "How PowerShell works for Developers".
As a C# developer, learning PowerShell was ... trivial. EXCEPT for all of the damned exceptions to what I EXPECTED would be the case for a LANGUAGE (PowerShell) ultimately 'written' on .NET and/or with the idea of being able to natively run .NET code, return objects, and the likes. So much of what I would've expected and or took for granted ... just wasn't the case. Causing plenty of lost hours, a bit too much cursing, and serious frustration with PowerShell.
And you've nailed it. Learning PowerShell as a developer? meh. Actually using it, you're in for a few shocks. That'll piss you off.
Like ... left-side-wins. For a C# developer that's not just blasphemy, it's unthinkable (a design goal of C# was to get rid of that 'holdover' from C++) - so left-side-wins is SO counter-intuitive.
Arrays, yeah, more like duck-typing from JS. Confusing and odd - compared to your expectations. WICKEDLY delicious once you get what's going on AND what you can do.
Can't tell you how many times I LOST an hour here or there (back before AI made a LOT of this shite trivial) cursing PowerShell cuz it just swallowed my well-named $input variable.
And I'm guessing that SysAdmins, 'scripters', and other folks familiar with "shells" are likely going to poo-poo a number of the details you've outlined here.
They're not your audience. And yeah - this all stuff I've HATED about USING PowerShell until I've been able to make most of it second nature (and migrate fully to the "Dark Side").
11
u/BlackV 22h ago
Holy smoke, Mr Kevin Marquette themself, Ghost from posh past and blog king, Welcome
5
u/me_again 21h ago
I think PowerShell has a lot in common with JavaScript or bash. They are the default languages for certain kinds of activity, but as languages they have quirks which are now unfixable due to back-compat concerns and which grate on developers who want a "Real Language" suitable for writing large systems.
I still remember discovering that
@[] -eq @[]is neither true nor false, but an empty array 🤯. Which is explained clearly in your doc but I still maintain is a design flaw.2
u/Dry_Duck3011 23h ago
Bit of a gap in your blog! I’ve missed your posts!
2
u/MasterChiefmas 20h ago
I think the first 2 comments about running scripts and the execution policy being a security boundary are a bit iffy.
DOS/Windows is the odd one out for running things in the default folder. Macs and Linux shells all do that as well by default. If you are strictly a Windows person that's only ever used the cmd shell, then it's a fair comment to some degree. But running things in . by default is the oddity, at least by shell, not by user base. MS aligned Powershell to behave like most other shells is all.
As for changing the execution policy...it is(or can be) a security boundary. If you are in a domain environment, your ability to change the execution policy can be restricted. It's more of a conditional situation that people on other OSes or that aren't domain joined don't see.
The execution policy, to some degree least really only makes contextual sense in a Windows environment. If you don't run powershell in other environments with elevated privileges(i.e. sudo) it's not like you can bypass the security models there. Those are largely things that you can find a problem with vs other OSes because other OSes don't generally have a centralized management situation that they have to deal with. A developer in a corporate environment may find they in fact can't just change the execution policy to whatever they want.
I just feel like those are a bit of a stretch like you are actively seeking things to be annoyed about. Later on you complain about the effort to make it easier for Linux natives to use Powershell(and yeah, it's not 1-to-1 given the constraints of the nearest equivalent in PS)...so which is it, do you want it to try and behave like Linux or not?
7
u/CaelFrost 23h ago
"Output is objects" - yes, the selling point I love as a developer. But sure, you go wild with your regex/grep.
5
u/RE20ne 18h ago
good stuff. my experience is that devs love powershell after they have spent a few weeks with it. the hate is strictly before that part.
5
u/rdldr1 18h ago
I love Powershell. It does what you tell it.
1
u/cottonycloud 21h ago
Excellent post! Touches on most of my pain points, coming from Java, C, C++, Python. PS7 has fortunately cleaned up many of my old gripes but there are still some.
- Classes and importing are a big one. There really should be only one way to import that includes classes. I cannot think of a reason why I would not to import classes as well.
- Dynamic scoping - Sorry I just don’t like it lol. If I wanted that variable, I’d have declared it as a parameter.
- Null and errors - To me, undeclared variables should always throw an exception and I shouldn’t have to toggle strict mode.
- Aside, I wish VSCode (I guess PSScriptAnalyzer) highlighted automatic variables and could discover undeclared variables.
- Null-coalescing with variables often involve enclosing the variable as such ${var}?.method(). A bit annoying for sure.
- No “using” statement to enclose variables. Just a minor gripe here.
1
u/scrumbud 20h ago
Good write up. I've been using powershell for years, and didn't know about the comparison operators functioning as filters.
1
u/PinchesTheCrab 1d ago edited 23h ago
My biggest issue is the I have to do everything myself because of the lack of security tooling for PWSH compared to other languages.
When I download java libraries I can use a proxy that scans them for vulnerabilities. I can look at a version history with known vulnerabilities and scan results. With all the vulnerabilities AI has discovered lately we have daily standups to discuss security scan results and establish remediation deadlines.
There's no equivalent for PWSH. I host a nuget feed in our repository where I can publish modules and proxy the psgallery, but no security scans are happening on the random third party modules users are installing. It's the wild west, and I think we're one major incident away from cutting off external module downloads entirely.
PWSH lives between scripting and programming and I love it, but it's definitely not a first class citizen among programming languages.
1
u/neotearoa 19h ago
Kevin, I'm a genius dumbass. I've failed up in it my entire career; held back by crippling ADHD and boosted by methylphenidate and the late age diagnosis chip on both shoulders. I'm currently squashing 50 pounds of shit into a 40 pound bag using AI and so so many times have I been stung by the fact that llms have been trained on not powershell.
That section alone was almost more significant than the article in its entirety for me.
As I read each paragraph, I chuckled a little thinking yup, been bitten by that before when writing pre AI.
Then quietly another more recent and less decipherable feeling of familiarity arose that was immediately unlocked at the training paragraph.
Cheers from the top of the world, in the best, least drawn country you know.
1
u/alconaft43 23h ago
I would keep away devs from using powershell to deploy their products.
1
u/AGsec 21h ago
This is great for non developer too. I am really trying to internalize "The PowerShell way" and this is a good reference to not only understand "the way", but see how it's done in the developer world and why. One of the harder things about PowerShell is that a PowerShell power user can be very different from most other power scripters and developers, so this article serves as a handy cheat sheet that bridges the gap when talking with others who are not PowerShell centric.
1
u/McWormy 20h ago
Depends what you mean by developing. I certainly wouldn’t use it as a dev tool.
Administration, yes.
1
u/wonkifier 17h 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:
Note the () around the increment
--
Without that, the index is empty.
BAD:
--
Similarly, without the scoping, it doesn't work either, even with the parens. This just shows "1" for each row
BAD:
--
Remove them both, and you're back to empty
BAD:
--
It's extremely unintuitive
1
u/Contao 8h ago
This is $true
1
u/smallestworry 1h ago
This explains why I hate powershell even though I really really need it. So happy to have Claude to write it for me, saves hours of stupid syntax debugging.
1
u/chrisdrobison 52m ago
Powershell definitely has its eccentricities for sure. But, as a developer, PS is often my go-to because it is a full programming language in a scripting language and to me that is huge. Every time I use something like Bash, I forget it is mostly just an orchestrator of running different processes to get things done--which is fine, but it's a total pain when I do actually need something more complex.
1
u/Aecnoril 29m ago
Funny, currently building a WPF app to automate Active Directory processes through a Powershell Command builder. And I can recognize some of these struggles I had when I first went to powershell. Luckily that's all way behind me now.
-6
u/Medium-Comfortable 23h ago
That's where I stopped reading. No shit Sherlock, a different script language behaves differently.
-2
u/VirtualDenzel 23h ago
Its just that paupershell (as we call it) likes to make its own rules. Has documentation that does not get updated. Graph changes weekly and is a mess.
Sure its handy to do some with powershell cmdlets. Ht for windows cmd.exe was just as good.
Compared to almost all other languages i ever coded in is paupershell a joke.
-1
u/Dave_A480 16h ago
Because the whole idea of an object oriented CLI scripting language is nuts.... And if you really want that there is Python (but you're a sadist)....
The Unix CLI (simplified to bash, although ksh or any of the Bourne variants fits) is much simpler, has more powerful text processing functions, and aside from some historical curiosities (ls instead of list because 2 bytes better than 4) overall makes more sense....
That said, it's a better way to interact with VMWare than the pointyclicky web interface, for interactive administration tasks (Ansible is better for automated/repetitive ones).....
And the best way to interact with Windows Servers for interactive administration
0
u/Szeraax 17h ago
This is a very good writeup, KevMar. You correctly hit some of the big pain points with classes.
If we were still in 2022, I'd probably yell about you not griping about method chaining on the annoyances for developers trying to use classes. :P But in 2026 where AI is writing a lot of the code, its just as easy to let the AI write the code with all the needed methods fully flushed out.
-2
u/anarchyusa 20h ago
I think PowerShell really was broken out of the gate with it’s Verb-Noun i.e putting the method before the object then supplying other methods downstream. That’s not an opinion or just a product of habituation. Keeping to one hierarchy is objectively better from an objective, neurological standpoint.
-6
u/JoelyMalookey 19h ago
Terrible article nitpicking 101 stuff?? Consisting it can use any .net library it’s just a bad take article