Windows sysadmin here. PowerShell has been great for a long time, well, since at least v5.1, when they finally fixed many of the annoying issues and limitations of earlier versions. I practically live in it the whole day - 90%+ of my work life is in PowerShell these days.
But I question its utility on other platforms, because a lot of the things that makes PowerShell cool on Windows doesn't actually work in Linux or macOS.
Eg: Get-Service (and associated cmdlets). Very handy cmdlet that I use all the time on Windows. On Linux, you'd expect that it'd work with systemd units, but no, that command doesn't exist on the Linux version. Same with Get-NetAdapter, or Get-NetTCPConnection, or Get-Disk and so many other handy cmdlets that I use all the time on Windows, are all missing.
Yet, some cmdlets do exist, like Get-Process or Get-Uptime etc, so I don't understand why many of the commonly used Windows cmdlets haven't been ported over.
Another annoying quirk is how PowerShell on *nix hands off some of the built-in aliases to their native versions. Like on Windows, I always use 'ls' because ain't nobody got time to type Get-ChildItem. Unfortunately when I run this on *nix PS, it runs the native version. And this is a problem because when I pipe 'ls' into a for loop or another cmdlet for further processing, it naturally, doesn't work. To make things worse, this native-or-alias decision making isn't even consistent. Like 'pwd' for example actually runs the PowerShell version, whereas 'echo' runs the native version.
Basically, as much as I love PowerShell on Windows, on *nix it is very annoying to work with. I would much rather work with native *nix shells and scripting languages. And if I really wanted the structured output of PS, I would run Nushell instead, which is far more consistent and useful than the half-baked product that *nix PowerShell is.
You can fix that very easily in your linux profile (make ls call gci and not native tool). Just add alias in your profile. You cant really complain about the absence of some cmdlets on linux, and they are trivially easy to get implemented (or wrap native tools).
I shouldn't have to do Microsoft's job. My point is that they put out a half-baked, nerfed shell for Linux, which is not cool. If they really wanted PowerShell to be taken as a serious, cross-platform shell, they should aim for 1-1 parity with the Windows version, or at least close to it. It's been 6 years since v7 came out, they've had plenty of time to do it.
If you want me to fix up Microsoft's slop, I'd rather contribute to a proper indie FLOSS project, like Nushell or something.
I personally prefer nushell[0] over PowerShell for similar tasks. My main is still Fish, but I occasionally use nushell when interactively exploring structured data (e.g. JSON files because I always forget the jq syntax) and specific nushell scripts I have (e.g. finding all the available nodes with GPUs on a SLURM managed HPC printed as a pretty table), which I find much easier to write than bash/fish.
I have only ever used Powershell when I had no other options, but a decent number of the APIs feel designed by someone who has never used a terminal. Like they were begrudgingly fulfilling the objective without ever imagining a real use-case.
Naturally, I cannot produce an example off hand, but I was pretty disappointed the last time I had to reach for it and found that a few "obvious" workflows seemed more hacky than I would have expected for a clean-slate terminal language design.
From what I get, the Designer hated Bash specifically. (As some1 who had 2 use it, can related) The syntax confusing, clunky & slow.
Said guy then proceeds to build a Shell which is even slower, the Syntax more convoluted than anything else
I recently installed Powershell 7 because apparently that is different than the powershell that comes with windows. It's great, but, now I have at least 3 different Powershells in my OS? Why? And they function very differently. I had to change all the defaults for opening a new terminal or new shell window in Windows because many of the defaults kept giving me one of the old powershells which I wouldnt figure out until my commands and scripts kept giving errors, since they use commands which only exist in Powershell 7. Cannot believe Microsoft decided to copy Python's original sin and create several conflicting, coexisting installations of the exact same thing, but different incompatible versions. Whyyyyyyyy
Regarding the article: Corbin Davenport is an amazing name. Nice article too.
>3 versions
NOO! Maybe there is one 5.x? You should get rid of these.
Version 1.0/2.0 is called 'WindowsPowershell' (powershell.exe), it's usually in your System32 for compatibility reason.
'PowerShell7' (pwsh.exe) is the modern one. It Imports most Modules/Scripts from the former, except for 3 Modules or so which are incompatible.
PS> Get-Help -Name 'InsertName' -Full
Shows the Help, can be Imported/Created via XML 4 New Modules
PS> Update-Help -UICulture en-US
Fetches & Installs Help Files in English
Powershell is so good that I find it strange it didn't get to be default at least in some Linux distributins (or some proper fork/redo of it). I even used it for integrative feautures for some of my state projects serving millions of user. The fact that I have proper language, designed for shell, very efficient, not needing an IDE or anything, is quite liberating.
If I am nitpicking, performance could be better, although MS did a lot in previous years and even that just in theory as I was never really blocked by that. But if it could be performance beast too, I would think we can stop researching new shells and just use it everyhwhere.
JSON support is amazing - you don't learn anything new like with jq, it just works. Selecting stuff is amazing, I love it more then SQL. HashTables are epic for configuration (you have a real language in it, unlike in lets say YAML).
Scripts that look horrible in bash are few lines of beautiful in pwsh.
If you didn't try it, or didn't give it a chance, you are missing out for sure.
I must ask, do you not find Powershell's commands to be too huge and unwieldy to easily type? Or do you use autocomplete often enough that having to write complex camel case with hyphens for every single command is not a problem? That's where I trip up when writing anything for Powershell.
Yup. IMO the syntax is unusably awful for interactive sessions. Scripting, where you want to come back a year later and tell at a glance what it's doing, sure. Not for daily driving though.
It feels like the difference between old-timey classical English vs street talk. "Greetings, dearest companion, how fare you this fine Autumnal day?" is a lot of syllables for someone you're familiar with. "Hey! Enjoying the day?" says the same thing, but conversational. There's a time and place for the former, mainly when writing dialog set in 1500 or something. I'd much rather say the latter when bumping into my neighbor at the cofee shop. Similarly, I could see why someone might want to write
Get-ChildItem -Filter *.txt -Force
in a script so that it's clear-ish what that means later, but if I'm spending my time in a terminal, I'd vastly rather learn what
ls -la *.txt
means. It's terse to the point of inscrutability, and not beginner friendly at all, but once you type it a few thousand times it's second nature.
All things considered, I'll stick to Fish, thanks.
All of the alternative shells are in a tough spot. Bash is lousy, but it is installed everywhere. If you are going to use an alternative, why not a more widespread tool (Python, Perl, etc) that can potentially do more than piping commands together.
I believe nushell is the closest Linuxy Powershell implementation with structured data.
I have to admit it's better than scripting in Bash, but in my personal opinion that's a bar so low it's on the ground. Don't get me wrong, I'm grateful that shell scripting is a thing. But my policy for a decade has been that when I need any logic more complex than a simple string matching in an `if`, I should back away from the computer and then rewrite it in a reasonable scripting language.
Powershell is definitely a reasonable scripting language; it's mainly its verbose command names and new-to-me syntax that have made me put off learning it so far. I suspect that it looks more familiar and welcoming to .NET devs though.
Perl python tcl have been around for over 30 years. Anyone writing in bash/sh etc is producing unmaintainable line noise (and I was a perl and APL programmer)
Part of setting up a new Windows or Linux machine for me is installing the latest PowerShell 7+.
My $PROFILE has custom modules that comprise ~9,000 lines of PowerShell. Anything "script-y" that I think I'll do more than a few times becomes a new function in one of those modules.
On Windows, I haven't used `cmd.exe` in at least a decade.
And part of my root `AGENTS.md` is "Please use PowerShell when generating scripts, unless I specifically ask for a different language."
Works a treat.
Once you get used to passing objects between commands - not just text - the thought of using a Unix-y shell feels like visiting the past.
PS is really powerful for Windows OS level concepts and enterprise software that have good modules (AD, IIS, Citrix). However it has so many semantics that can burn you; non-strict mode, implicit type conversion, ordered null checks [1], not to mention the amount of boilerplate in a module and the runtime overhead. At a certain scale/complexity you need to graduate to using C# and .NET.
I like Powershell but what's funny is you can now write single file C# scripts and run them from the dotnet command. No need for a solution or anything. Actually pretty nice for shell scripting now.
I find that PowerShell's syntax choices and verboseness make it just as cryptic as bash. "Okay, now we Get-Object... Ah crap, that's not it, what was it again? Ah yes, Select-Object... Okay now we pass that into Call-WebRequest... Wait that's not it either...".
The language designers managed to introduce the ambiguity of natural language into a shell scripting language. As a developer, I think that it makes PS wildly unergonomic and I find it easier to remember bash/Linux idiosyncrasies.
Comparing to Bash is cheating, though. Try comparing it to Python. We don't need to have one tool for every task. On Linux we have always had support for multiple scripting languages. Use the right one for the job.
Yes, since 7.3. But in that typical verbose and awkward PowerShell way. My quip about PowerShell is that if they called it PowerScript, you'd realize it was bad Python.
Great tool for Windows admins who haven't realized they can write quick and dirty C# scripts cross platform for a decade now.
Been using oh-my-posh in powershell, and some aliases to map commands for my old linux sysadmin brain. Everything mostly works to get the job done, even got vi and scp. Its just another tab in my windows terminal with my ubuntu tabs.
Yeah, you're not the first to discover this, but I'm curious how you'll feel in a few years. I recall three years ago my wife got a new gamer laptop and had nothing to do with her old one. I don't game, but got curious about playing around with Hyper-V. Packer at the time had no working builder for it, so I figured I'd make my own to create Linux VM images I could run on Windows, sort of "roll your own WSL." I quickly discovered PowerShell and unexpectedly fell in love with it. It only took me a few hours to have a working implementation roughly identical in function to Packer but without having to write any compiled code at all. It was pure PowerShell modules. This was before LLMs. I wrote it all myself, in a language I'd never used before, using documentation I had to search the web for using a plain search engine, and it still only took a few hours and did exactly what I wanted.
It didn't revolutionize my life, though. Three years later, I no longer use Windows for anything and revert to plain POSIX shell whenever possible for all scripting, largely for ecosystem reasons. Everyone else I work with is using that. I'd analogize this to challenges living downtown in the middle of a busy city. My roads are terrible, largely because they're so patchwork due to utilities and construction teams needing to tear out pieces, fix or add something underground to accomodate new building, then put the road back together again. It means you'll have 30 meters of regular concrete, then 10 meters of asphalt, then 20 meters of some pebbles in glue looking monstrosity. It works well enough for cars with large rubber tires and suspension systems, but it's hell for skateboarding. Go out to the suburbs where the entire road is all the same substance and it's smooth sailing.
Hacker News and the web more generally seems like these discussions about tooling and dev experience end up dominated by solo developers. If you're the only person working on a project, let alone these days with LLMs where half the breathless posts are about software where you're not only the sole developer but also the sole user, do whatever you want. It's like moving all the furniture around in your room every single day when you live alone. Go for it. But if you have a spouse, whether or not your new design is better than the old one, that's kind of rude. When you're part of a team, you have to eventually settle on all doing roughly similar, predictable things so you're not disrupting everyone else's workflows and expectations, even if those roughly similar, predictable things are suboptimal and there's a better way.
But I question its utility on other platforms, because a lot of the things that makes PowerShell cool on Windows doesn't actually work in Linux or macOS.
Eg: Get-Service (and associated cmdlets). Very handy cmdlet that I use all the time on Windows. On Linux, you'd expect that it'd work with systemd units, but no, that command doesn't exist on the Linux version. Same with Get-NetAdapter, or Get-NetTCPConnection, or Get-Disk and so many other handy cmdlets that I use all the time on Windows, are all missing.
Yet, some cmdlets do exist, like Get-Process or Get-Uptime etc, so I don't understand why many of the commonly used Windows cmdlets haven't been ported over.
Another annoying quirk is how PowerShell on *nix hands off some of the built-in aliases to their native versions. Like on Windows, I always use 'ls' because ain't nobody got time to type Get-ChildItem. Unfortunately when I run this on *nix PS, it runs the native version. And this is a problem because when I pipe 'ls' into a for loop or another cmdlet for further processing, it naturally, doesn't work. To make things worse, this native-or-alias decision making isn't even consistent. Like 'pwd' for example actually runs the PowerShell version, whereas 'echo' runs the native version.
Basically, as much as I love PowerShell on Windows, on *nix it is very annoying to work with. I would much rather work with native *nix shells and scripting languages. And if I really wanted the structured output of PS, I would run Nushell instead, which is far more consistent and useful than the half-baked product that *nix PowerShell is.
If you want me to fix up Microsoft's slop, I'd rather contribute to a proper indie FLOSS project, like Nushell or something.
The web was successful because the installation cost was 0.
0: https://www.nushell.sh/
Naturally, I cannot produce an example off hand, but I was pretty disappointed the last time I had to reach for it and found that a few "obvious" workflows seemed more hacky than I would have expected for a clean-slate terminal language design.
Test-NetConnection -ComputerName dns.google -TraceRoute
Regarding the article: Corbin Davenport is an amazing name. Nice article too.
PS> Get-Help -Name 'InsertName' -Full Shows the Help, can be Imported/Created via XML 4 New Modules PS> Update-Help -UICulture en-US Fetches & Installs Help Files in English
Hope that helps!
I use it for all kinds of stuff. Here is an example that creates MusicBrainz collection from my local audio folder, solving the browsers proof of work in between: https://github.com/majkinetor/musicbrainz-userscripts/tree/m...
If I am nitpicking, performance could be better, although MS did a lot in previous years and even that just in theory as I was never really blocked by that. But if it could be performance beast too, I would think we can stop researching new shells and just use it everyhwhere.
JSON support is amazing - you don't learn anything new like with jq, it just works. Selecting stuff is amazing, I love it more then SQL. HashTables are epic for configuration (you have a real language in it, unlike in lets say YAML).
Scripts that look horrible in bash are few lines of beautiful in pwsh.
If you didn't try it, or didn't give it a chance, you are missing out for sure.
It feels like the difference between old-timey classical English vs street talk. "Greetings, dearest companion, how fare you this fine Autumnal day?" is a lot of syllables for someone you're familiar with. "Hey! Enjoying the day?" says the same thing, but conversational. There's a time and place for the former, mainly when writing dialog set in 1500 or something. I'd much rather say the latter when bumping into my neighbor at the cofee shop. Similarly, I could see why someone might want to write
in a script so that it's clear-ish what that means later, but if I'm spending my time in a terminal, I'd vastly rather learn what means. It's terse to the point of inscrutability, and not beginner friendly at all, but once you type it a few thousand times it's second nature.All things considered, I'll stick to Fish, thanks.
I believe nushell is the closest Linuxy Powershell implementation with structured data.
https://www.nushell.sh/
Powershell is definitely a reasonable scripting language; it's mainly its verbose command names and new-to-me syntax that have made me put off learning it so far. I suspect that it looks more familiar and welcoming to .NET devs though.
Perl python tcl have been around for over 30 years. Anyone writing in bash/sh etc is producing unmaintainable line noise (and I was a perl and APL programmer)
My $PROFILE has custom modules that comprise ~9,000 lines of PowerShell. Anything "script-y" that I think I'll do more than a few times becomes a new function in one of those modules.
On Windows, I haven't used `cmd.exe` in at least a decade.
And part of my root `AGENTS.md` is "Please use PowerShell when generating scripts, unless I specifically ask for a different language."
Works a treat.
Once you get used to passing objects between commands - not just text - the thought of using a Unix-y shell feels like visiting the past.
PS is really powerful for Windows OS level concepts and enterprise software that have good modules (AD, IIS, Citrix). However it has so many semantics that can burn you; non-strict mode, implicit type conversion, ordered null checks [1], not to mention the amount of boilerplate in a module and the runtime overhead. At a certain scale/complexity you need to graduate to using C# and .NET.
[1] https://learn.microsoft.com/en-us/powershell/utility-modules...
And then passing text lines with > like a caveman. Does bash not have the concept of objects?
You write Invoke-WebRequest and it invokes a web request. Easy.
The language designers managed to introduce the ambiguity of natural language into a shell scripting language. As a developer, I think that it makes PS wildly unergonomic and I find it easier to remember bash/Linux idiosyncrasies.
Great tool for Windows admins who haven't realized they can write quick and dirty C# scripts cross platform for a decade now.
It didn't revolutionize my life, though. Three years later, I no longer use Windows for anything and revert to plain POSIX shell whenever possible for all scripting, largely for ecosystem reasons. Everyone else I work with is using that. I'd analogize this to challenges living downtown in the middle of a busy city. My roads are terrible, largely because they're so patchwork due to utilities and construction teams needing to tear out pieces, fix or add something underground to accomodate new building, then put the road back together again. It means you'll have 30 meters of regular concrete, then 10 meters of asphalt, then 20 meters of some pebbles in glue looking monstrosity. It works well enough for cars with large rubber tires and suspension systems, but it's hell for skateboarding. Go out to the suburbs where the entire road is all the same substance and it's smooth sailing.
Hacker News and the web more generally seems like these discussions about tooling and dev experience end up dominated by solo developers. If you're the only person working on a project, let alone these days with LLMs where half the breathless posts are about software where you're not only the sole developer but also the sole user, do whatever you want. It's like moving all the furniture around in your room every single day when you live alone. Go for it. But if you have a spouse, whether or not your new design is better than the old one, that's kind of rude. When you're part of a team, you have to eventually settle on all doing roughly similar, predictable things so you're not disrupting everyone else's workflows and expectations, even if those roughly similar, predictable things are suboptimal and there's a better way.