4 ms·
I disagree with pretty much your entire comment. > PowerShell as a scripting language is a major PITA. Well, except this part. > After 2 hours the script wou
by runjake 5y ago
I disagree with pretty much your entire comment.
> PowerShell as a scripting language is a major PITA.
Well, except this part.
> After 2 hours the script would abruptly quit because of some syntax error. 2 hours wasted.
As mentioned by another commenter, the PowerShell script is parsed up front, so it probably wasn't a syntax error. My guess is the script lacked error handling and some query or connection to a remote server failed.
> A lot of Microsoft plugins have PowerShell plugins. This is what makes PowerShell valuable, not some attribute of PowerShell itself.
There we go agreeing again. Although, PowerShell is effectively self-documenting, which is good for busy sysadmins.
> Really what Microsoft should have done is to make those plugins available to C#
A lot of them effectively are available to C#, such as System.DirectoryServices.*. In the early days of Active Directory, before PowerShell, this is how we did things. While fun for us programming nerds, it took a hell of a lot more time to write usable tools.
> C# is as easy as most scripting languages in any case
Hard disagree.
> Make C# usable like Dino for TypeScript (i.e., transparent compilation).
A more C#-like scripting language? I'm all for that, but why not just use TypeScript at that point (ala the JScript days).
> Then any syntax errors in the script can be caught ahead of time, instead of after 2 hours of running.
No, you run into the exact same challenges, whether it's PowerShell or C#.
IMHO, while I'd rather be doing C# programming any day of the week, PowerShell is more approachable for the vast majority of Windows sysadmins out there. Additionally, due to the command... verboseness of PowerShell, it is effectively self-documenting.
Edit: Snover's original Monad Manifesto paper is worth a read for his reasonings about what is now PowerShell: https://www.jsnover.com/Docs/MonadManifesto.pdf https://www.jsnover.com/Docs/MonadManifesto.pdf
It might be best summarized by this partial quote: "PowerShell replaces fragile, prayer-based text parsing with pipelines of objects (structured data)"
- fartcannon 5y agoYou're implying sysadmins aren't smart enough to use C#. You shouldnt speak down to a whole group of very intelligent people like that.
- jorl17 5y agoI think the idea is more that they have less time to spend worrying about compiling or deploying C# applications.
- fartcannon 5y agoHis exact words are, "IMHO, while I'd rather be doing C# programming any day of the week, PowerShell is more approachable for the vast majority of Windows sysadmins out there." IE, the vast majority of SYS admins aren't capable of approaching C#. Fully unsubstantiated heresay. If they can learn the cryptic nightmare that is power shell, they can certainly learn C#.
- cornstalks 5y agoThat's an extremely uncharitable interpretation of the quoted sentence. Just because X is more approachable than Y to a person doesn't mean they're incapable of approaching Y. The sentence makes no claims in regards to a sysadmin's capability.
- fartcannon 5y agoUncharitable? Read his follow up that starts with: "A lot of sysadmins: 1. Aren't "very intelligent"." A spade is a spade.
- hhh 5y agoI don’t want to write C#, I want something that can be that powerful when I need it, and be fast when I just want to get something done. Powershell is where I go in the Windows/M$ world, Python is where I go in the nix world. There’s very few times that I need to write a Powershell script that runs like a daemon. I’m typically using it in a notebook in VSCode, but I do* have Kubernetes jobs that are written in Powershell that run periodically. They were quick and effortless to write, run fast (dotnet core,) and are easy for my team to understand if they want to modify them or someone needs to maintain them. None of my team would willingly learn C#, nor would the business support them writing C#. A powershell script though? Fair game for anyone who wants to look at something new and innovative, it requires nothing if they use ISE, and if they want to, VSCode is already an approved app. Need a hosting platform? You can deploy on Kubernetes if you really want. It’s a really big barrier to entry to force someone to use C#.
- tyingq 5y ago>> Really what Microsoft should have done is to make those plugins available to C# >A lot of them effectively are available to C# True, though some of them aren't. I ran into one recently...setting the metric value for an ip interface (not a route, an interface). Powershell has that, C# does not, in any way that I can find.
- teh_klev 5y ago> I ran into one recently...setting the metric value for an ip interface (not a route, an interface). Powershell has that, C# does not, in any way that I can find. It can be done in C# via WMI (System.Management), but that's a strange old world if you're not used to it. But it's more convenient in Powershell because MS provide modules such as NetTCPIP so you don't need to touch WMI directly.
- sofixa 5y ago> Although, PowerShell is effectively self-documenting, which is good for busy sysadmins. Oh no it isn't. Very basic stuff like Get-Something piped into a Remove-Something is, but beyond that, it gets complex quick. Add aliases, weird logic and limitations ( do you know you can't break out of a Foreach-Object?), and it quickly becomes an illegible mess that needs parsing, the same way Python might. Furthermore, a lot depends on the cmdlet provider, and for instance the VMware ones are steaming piles of horseshit with inconsistent naming of parameters, broken async, and useless error management ( e.g. you get an error which says to check the inner exception, but it's empty and there's no way to get any detail whatsoever).
- kaba0 5y agoI would still take that over the cryptic -fHxC magic incantations of unix tools. Especially that you get unified help for all of them, readily available. And I say that as someone who really doesn’t like windows (and thinks it is not fit for development at all) — but powershell is really a gem, if one gets over the at first strange syntax and actually looks into it.
- throwaheyy 5y agoThe first paragraph is just sloppy coding practices which can render any scripting language, not solely Powershell, illegible.
- majkinetor 5y ago> do you know you can't break out of a Foreach-Object? I don't because you can. > Furthermore, a lot depends on the cmdlet provider, WTF, bash is unusable unless grep, sed, awk and friends are present .
- delusional 5y ago> WTF, bash is unusable unless grep, sed, awk and friends are present. No one is calling bash self documenting, so that comparison doesn't mean anything.