r/PowerShell • u/KevMar Community Blogger • 7d 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/kagato87 6d 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.
66
u/aguerooo_9320 6d 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.
17
u/Solonotix 6d 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 lol30
u/AngryPets 6d 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").
14
u/BlackV 6d ago
Holy smoke, Mr Kevin Marquette themself, Ghost from posh past and blog king, Welcome
5
u/me_again 6d 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 6d ago
Bit of a gap in your blog! I’ve missed your posts!
2
u/MasterChiefmas 6d 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?
9
u/CaelFrost 6d ago
"Output is objects" - yes, the selling point I love as a developer. But sure, you go wild with your regex/grep.
16
u/ManiacalMartini 3d ago
Sysadmin: "You can do this function natively in Powershell"
Dev: "No thanks, I'm going to install this vulnerable version of Python instead and create a script that will break if Python gets updated."
6
u/rdldr1 6d ago
I love Powershell. It does what you tell it.
5
u/RE20ne 6d 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/Alternative-Tie-4970 5d ago
I formerly had a dayjob in a company that uses almost exclusively windows.
Since I was in an administration department I had extensively made use of powershell.
Powershell, in my eyes, went from cryptic to actually really... well... powerful. It has a genuinely fantastic workflow which a conventional shell lacks, and while I still prefer conventional shells for my day-to-day usage, I will never complain about having to use powershell.
1
u/cottonycloud 6d 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 6d ago
Good write up. I've been using powershell for years, and didn't know about the comparison operators functioning as filters.
1
u/ka-splam 4d ago
Hi KevMar, this is off-topic, but years ago I think you had a blog post about bringing firewalls into automation - joined a team with individually managed devices, version controlled and verified all the configs, and script-re-deployed them without disruption.
I went looking for it recently and couldn't find it.
Was it your blog, and if so is it still around or have you removed it?
1
u/chocolateAbuser 3d ago
the issue is rules are not simple, this doesn't work if you have to use it those two times a years you need to do a """""simple"""" script to loop something, too many weirdnesses and random wtfs; i guess the first is the output discard, when i saw that it immediately burn into my neurons as one of the biggest wtf and i'll never forget it, the other thing is string templates, which sacred combination of symbols and punctuation to use to print a string with a variabile in it... it takes at least 10 tries, the i give up an ask ai to do it
3
u/smallestworry 6d 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.
3
u/surfingoldelephant 5d ago
Regarding "Verbosity is a feature", I've seen a lot of PowerShell naysayers conflate script writing best practices with shell usage. They believe PowerShell's verbosity is mandatory, including in the shell, and get discouraged from actually giving it a proper go.
Once they realize a) you don't have to use the shell like you'd write a script and b) there are actually benefits to embracing verbosity in script writing, I've found they're a lot more amenable to giving PowerShell a fair chance.
1
u/PinchesTheCrab 6d ago edited 6d 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 6d 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/DoctorSalad8682 1d ago
As a sysadmin, powerfully is incredibly easy for me. I went to college and spent 4 years learning python, php, and Java. Just because you dont understand powershell doesnt mean it's flawed. We all learn differently, and i love the power and flexibility of powershell. If it doesnt make sense to you, use something else. I dont understand you venting your frustrations to the internet hoping for some solace because something that is fantastic and intuitive for most sys admins doesnt make sense to you.
4
u/paintsbynumbers7 5d ago
Why would you hate on a tool, thats just junior talk. If it doesnt match your purpose, you find a different tool. You’re not supposed to enter a relationship with it.
3
u/Cheap-Success1578 2d ago
I simply abhor writing -eq instead of ==, or -ge instead of >=. It's really stupid.
1
u/alconaft43 6d ago
I would keep away devs from using powershell to deploy their products.
1
u/AGsec 6d 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 6d ago
Depends what you mean by developing. I certainly wouldn’t use it as a dev tool.
Administration, yes.
1
u/wonkifier 6d 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 6d ago
This is $true
1
u/chrisdrobison 6d 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 6d 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.
1
u/ankokudaishogun 5d ago
I'll be honest, the only thing I got out of the post is "Developers hate reading the docs. And *nix alias for Powershell cmdlets are stupid."
...I absolutely agree on the second part.
1
u/MonkeyNin 5d ago
For the "string is never null" part, there's an IsNotBlank function
It's quite reliable for blankable values:
It's a nice filter for filenames, usernames, etc that shouldn't only consist of control characters.
1
u/RobertDeveloper 5d ago
PowerShell breaks with every convention imaginable, thats why developers struggle so much with PowerShell. Not using comma as parameter separators is devious.
1
u/tsteelematc 4d ago
don’t hate ps, but find myself using, cmd+coreutils+clink, for transferable muscle memory across windows, macos, omarchy, and rando terminals in browsers, give it a try, says me ; - )
1
u/JustinAtNerdio 3d ago
PowerShell's idea of returning a value must be quite a surprise if you're coming from C#.
1
u/vodevil01 3d ago
Powershell is nice
1
u/ChiRho84 2d ago
I don't know, I learned both OOP and functional programming long before I learned PowerShell and PowerShell has always been frictionless for me.
-7
u/Medium-Comfortable 6d ago
That's where I stopped reading. No shit Sherlock, a different script language behaves differently.
-2
u/VirtualDenzel 6d 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.
0
u/Szeraax 6d 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.
0
u/KryptosFR 4d ago
PowerShell is unnecessarily verbose. I tried several time to learn how to use it. But compared to other shells when I can get things done with a few short words, with PowerShell I need to write a whole story.
And now that I can write single-file .NET apps, I have no use for PowerShell at all.
-2
u/Dave_A480 6d 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
-2
u/anarchyusa 6d 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.
-2
u/redd1t_is_de4d 2d ago
because powershell fucking sucks. itś just bash but way worse.
-7
u/JoelyMalookey 6d ago
Terrible article nitpicking 101 stuff?? Consisting it can use any .net library it’s just a bad take article