by d3Xt3r · 1mo ago · 0 comments
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.
var service = thisSystem.GetService("rss-news-feed");
service.SetRefresh(TimeSpan.FromHours(1));
service. //<----now we can autocomplete everything a service can do.
Edit: it's a travesty that OO get's shoehorned into architectural design of large systems whereas it would be ideally suited in a Nix-like API for interacting with operating systems which are 'solved'.
This seems quite hard to implement. There are also other init systems that PowerShell may chose to not support but then they'd need to add a disclaimer for supported systems. Also systemd is quite complex with its setup of user defined units, overlays etc.
That's not really a concern, I mean systemd is by far the most popular init system, and especially in a situation/environment where one might choose to run PowerShell it's highly unlikely that you'd be running any other init. Like if you're the kind who'd prefer dinit or S6 or something, you wouldn't even consider running a "bloated" shell like PowerShell in the first palace.
So there's no need to add a disclaimer. Microsoft can just deal with it the same way they deal with distro support - they officialy support Ubuntu but for others you're on your own, although they do provide tar.gz packages.
And yes, systemd is indeed quite complex but there's no reason it can't be translated across to PowerShell lingo, at least parts that makes sense.
Eg:
Get-Service -Name <svc> -> systemctl status <svc>
Start-Service -Name <svc> -> systemctl start <svc>
Stop-Service -Name <svc> -> systemctl stop <svc>
Set-Service <svc> -StartupType Disabled -> systemctl mask <svc>
And so on.They've had six+ years to do perfect this, which is plenty of time - if they were really serious in pitching PowerShell as a true cross-platform shell. But it seems like they don't really care, especially now that they've captured most Linux users by means of WSL2, so it makes more sense for them to invest in that rather than invest in cross-platform parity in PowerShell.
But Microsoft has the design documents, so it shouldn't be a problem to implement this functionality. /s
its faster then this discussion.
If you want me to fix up Microsoft's slop, I'd rather contribute to a proper indie FLOSS project, like Nushell or something.
Its not slop for one. Take a look at repo and its practices. Its mind blowing and predates AI.
Nushell is nice, but lets not get carried away - it is decade away from pwsh, and suffers from the same things you complained, with language and semantics that are not intutive as pwsh's and not nearly as complete. Besides, so many 3rd party supports pwsh like Sql Server, VMware etc.
I agree that MS should push it way more and make Linux variant even better. The problem is that pwsh hardly surived at MS (cudos to Snover for being stuborn and worked against his position at MS to make it happen), and that needs some opinionated people working in MS who can fight this battle (I could honestly dedicate my life to this, I offer my services, for both pwsh and Windows, Microsoft!).
The web was successful because the installation cost was 0.