17 ms·
This is why I find PowerShell to be an answer to a question nobody asked. If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to
by astrodust 10y ago
This is why I find PowerShell to be an answer to a question nobody asked. If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to do the heavy lifting.
PowerShell will never accumulate a library as comprehensive as what any of those three have, each has had decades to accumulate packages of all kinds, and more are still being added.
It's odd, but not surprising given their history of "Not Invented Here", that Microsoft never even considered using Python or Ruby when they both have .Net implementations. Their enthusiasm for JavaScript wasn't sufficient for them to embrace that either.
- xl 10y ago[Disclaimer: I work for Microsoft.] As far as I recall, the original impetus behind what became PowerShell (as handed down to us in a conference room by Ballmer himself, sometime around 2001) was to fill the gap between ops people who did enterprise administration manually with tools like MMC and engineers who automated enterprise administration with tools like C++/DCOM. The latter were necessary in a lot of cases, but they were expensive, and we needed to give the industry a way to do powerful automation without hiring a bunch of PhDs. So, yes, someone did ask for it - the IT industry.
- itomato 10y agoNot "The IT Industry", surely only a subset of Windows systems managers.
- jaredhansen 10y agoThat's actually a pretty substantial chunk of "the IT Industry" though. And if you're the people who make Windows, it's not surprising that it's a big enough chunk to do something about.
- jl6 10y agoI personally find that the term "IT" has become a bit of a code word for "Enterprise Wintel", and that anyone working outside of the gravitational pull of Microsoft prefers to describe themselves as working in "tech"
- toomanybeersies 10y agoI think that IT has become a code word for being a tech worker in a company, rather than a worker in a tech company.
- robotresearcher 10y ago> So, yes, someone did ask for it - the IT industry. ... who couldn't use the well-known mature shell tools since they were locked into a closed platform, and Windows' cmd.exe was comparatively very weak.
- mattzito 10y agoWell, lots of windows admins used things like cygwin and the like to get a unix-y working environment, but PowerShell offers a much more robust set of mechanisms to manipulate the underlying Windows operating system.
- Someone1234 10y agoIt wasn't cmd that was the problem (although, it is weak); it was how Windows exposed APIs to allow automated solutions. You had two options: VBScript (which is a glorified COM+ agent) or a "real" programming language like VB6/C# which mixed COM+ with Win32 API calls (which are too hard to use for most non-programmers). Powershell within itself does improve CMD. But that isn't primarily how PS pushed Windows automation forward, Microsoft said that every major server feature and server function should work in Powershell, so engineers at Microsoft had to look at it (be it their lacking COM+ interface, provide a new PS interface, or something else). The net result isn't that CMD got replaced by something better. It is that we have a lot more APIs and ways of interacting with Windows features and services than we ever used to. The ironic thing is that today you could write MS Dos-style console applications that work in CMD which provide all of this new automation functionality because of the Powershell push. Back before Powershell you'd have to hack it using unsupported APIs, registry entries and similar.
- toyg 10y agoIf all this API effort had gone into a real cross-platform language (Python, Ruby, or even Perl which was king in 2001), Windows would have flourished. They went for their traditional lock-in approach instead, so now they have to catch up.
- deleted 10y ago
- alistproducer2 10y agoI read this a while back. It's an interview with the dude who wrote PS https://www.petri.com/jeffrey-snover-powershell https://www.petri.com/jeffrey-snover-powershell
- aurhum 10y agoHis HN handle is JeffreySnover; He is commenting on this story at this moment.
- rbanffy 10y ago> a way to do powerful automation without hiring a bunch of PhDs. I remember writing Windows software with DCOM was difficult, but it was more on the painfulness side than a difficult intellectual endeavor. Sure you didn't need PhDs to automate things. > So, yes, someone did ask for it - the IT industry. The part of it stuck in Windows, that is. Vendor lock-in is a powerful thing.
- bluejekyll 10y agoYeah, DCOM was a task of fillout the correct fields with the correct values, and try again until you get it right. Anyone with passing C++ knowledge could do it through shear brute force. It's one of the things which made me never want to program on Windows again.
- kazinator 10y agoI ported a bunch of COM to Linux in the late 1990's. Not DCOM with the full RPC, but just in-process COM. I had .so shared libs with DllMain and DllCanUnload now in them, I had CoCreateClass, I had a significant part of the registry API implemented in terms of a text file store (HKEY_LOCAL_USER being in the home directory, HKEY_LOCAL_MACHINE somewhere in /etc, ...) and such. IUnknown, QueryInterface, AddRef, Release, ...
- snaky 10y agoThat's nice, but having CORBA implementations - why?
- kazinator 10y agoTo port some code as-is.
- MichaelMoser123 10y agoNetscape did that with XPCOM [1] they once thought that this is a good idea - i guess for versioning of interfaces; nowadays firefox has moved on from this. [1] https://en.wikipedia.org/wiki/XPCOM https://en.wikipedia.org/wiki/XPCOM
- chetanahuja 10y agoAll those sysadmins would have been perfectly happy with just a properly working unix like shell.
- coldtea 10y agoYes. Like all those early car buyers would be perfectly happy with faster horses.
- newacct23 10y agofalse equivalency
- coldtea 10y agoNo, actually it's quite apt. PowerShell, or at least the concept behind PowerShel, is an improvement/superset over the Unix shells -- and can do whatever the shells can do, plus stuff they cannot do, because they don't support typed entities. Its problems are not technical or conceptual -- they are ecosystem and historical: lack of compatible tools, windows-only, etc.
- matt_wulfeck 10y agoOr to the point of the original parent: the industry considers powershell a solution in search of a problem.
- pjmlp 10y agoOnly those that disregard the inventions from Xerox and ETHZ. Powershell ideas go back to how REPLs work in those environments.
- sigsergv 10y agoBoth PS and bash are horses actually.
- 10y ago
- scurvy 10y agoI was part of the Hotmail team which consisted mainly of Solaris admins trying to mass administer a giant number of Windows servers. We kept pleading with the Windows team and upper management (forgot who it was at the time, Raikes?) to give us a powerful shell and ssh on Windows. We ended up licensing FSecure's ssh daemon for windows. We also used cygwin, too.
- thoth 10y ago>forgot who it was at the time, Raikes? It was Allchin when I was there... about that era.
- nightski 10y agoPowershell can use any .NET library... "Nobody" meaning you. Which is perfectly fine. But there are quite a few users of Powershell out there.
- astrodust 10y agoNow that it exists there are users, but when people were hoping for a modern or more portable replacement for DOS batch files I'm not sure this is what they had in mind.
- Rapzid 10y agoPowershell In Action covers a bit of the history and decision making around powershell; interesting stuff. Ultimately, given that powershell was initially targeted at systems admins/engineers and that Windows is highly object-oriented(in contrast to Linux's text streams), I believe Powershell was a apt development. Having done plenty of systems engineering across linux and Windows it seems to fit the needs of Windows pretty well; a fantastically unique shell that wouldn't have existed if not for Windows.
- calgoo 10y agoThink of it as a replacement for vbscript instead, with a commandline.
- Jtsummers 10y agoLast IronPython release: 2014 Last IronRuby release: 2011
- __derek__ 10y agoI can't speak to Ruby, but Microsoft has an active Python group.[1] Granted, it seems to focus on Visual Studio (which I'm told has excellent Python tooling) and Azure. [1]: https://blogs.msdn.microsoft.com/pythonengineering/ https://blogs.msdn.microsoft.com/pythonengineering/
- stuaxo 10y agoLooks like things are changing in IronPython land: https://www.infoq.com/news/2016/08/IronPython-Leadership https://www.infoq.com/news/2016/08/IronPython-Leadership
- douche 10y agoI used to love Python when I came to it years about after slogging along through QBasic, VB6, C++ and C, but in this day and age, it doesn't really offer much to me over doing things in modern C#, especially on the CLR. I appreciate some of the changes that were made to the runtime to support IronPython, like dynamic support and the DLR, but if I'm going to be doing something not-C#, then I'd rather go towards F#.
- localhost 10y agoBoth of these two projects attempted to solve a problem that very few people have - using .NET libraries from Python and Ruby. In exchange, you had to give up all of your existing native libraries. That is a trade-off that very few people wanted. Source: I started the IronRuby project. I learned this lesson the hard way a few times in my career - always have respect for people's existing code investments.
- npsimons 10y agoI feel very similarly, but then I'm of the mind that if I can't apt-get it, I'm not interested, and I'll bet that "open source" doesn't mean to MS what it means to the open source world. As for the NIH syndrome, one of my favorite Paul Graham essays is still "What Languages Fix" (http://www.paulgraham.com/fix.html http://www.paulgraham.com/fix.html) particularly for C#: the problem that C# was invented to solve is that Microsoft doesn't control Java.
- Silfen 10y agoC# incidentally solved many other shortcomings with Java. The languages are getting closer to parity, but for many years C# was pretty far ahead (if you only consider language features and not tooling/ecosystem). Between reified generics, better native interop, and many functional features, C# felt and feels more concise than idiomatic Java. And I've written plenty of both. Disclaimer: MSFT employee expressing personal views
- jimmaswell 10y agoIn what way was C#'s tooling not better?
- artimaeis 10y agoJava seemed to have a lot more options for deployments and monitoring for a long time. More advanced 3rd party libraries in general. It had simply been around longer and thus had those tools available. Now that C# has been standard for a while almost all of those tools have a C# equivalent. As a .NET dev I'd actually argue that the things available to C# now are actually better (especially Visual Studio), but that's certainly biased.
- jimmaswell 10y agoVS was probably always a better coding and debugging environment. I've used VS as far back as VS 2010 and it's always been great for C#, but I've never had more than a mediocre experience writing Java in an IDE. Did anything support VS's level of convenient debugging ability for Java?
- JoshTriplett 10y agoFor programming, I agree. However, Python doesn't work as a system shell; for that, you want something optimized for running commands, without having to wrap them in a function call with a list of arguments as strings.
- denfromufa 10y agodid you try xonsh?
- skrebbel 10y agoI did, and i found it a pretty big chore in practice. Its two modes (shell mode and python mode), never quite knowing which one you're in, I could never quite get used to that. PowerShell doesn't have this problem, because it was designed for the command line first and for scripts second (which is, incidentally, also its major downside if you ask me).
- denfromufa 10y agoyou can force captured subprocess mode if necessary
- thaumasiotes 10y ago> Its two modes (shell mode and python mode), never quite knowing which one you're in, I could never quite get used to that. Drive-by armchair comment: it seems like the obvious answer would be to change the prompt depending on what mode you're in?
- fnj 10y agoI find this criticism of xonsh's "modes" baffling. Xonsh is brilliant precisely because it isn't modal the way, e.g., vi is. Xonsh lets you freely mix python code and command invocations in a highly transparent way.
- KirinDave 10y ago> This is why I find PowerShell to be an answer to a question nobody asked. If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to do the heavy lifting. I'm not sure this is really right though. You could make the same argument against Ruby or Python in favor of Perl or Pike, could you not? PowerShell syntax is quite minimal, has a novel methodology for strongly typed interactive use, and has the ability to directly invoke managed code. You can write shell components in any .NET language and invoke them (with care at writing time, this can be done very cleanly, but even without said care it's possible with a bit of a mess). > PowerShell will never accumulate a library as comprehensive as what any of those three have, each has had decades to accumulate packages of all kinds, and more are still being added. It has the entire .NET library at its disposal. I certainly never feel a lack of support using it.
- haberman 10y ago> This is why I find PowerShell to be an answer to a question nobody asked. If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to do the heavy lifting. How are Python/Ruby/Perl going to give you structured objects from "ps"? That's the promise of object-based pipes. You can get useful records out of your command-line tools without having to write an ad-hoc regex.
- rbanffy 10y ago> How are Python/Ruby/Perl going to give you structured objects from "ps"? The usual answer would be "by parsing /proc instead and returning meaningful objects that expose the relevant parts of the OS" but why would you want to do that when you could just output the relevant data in easy to parse XML or JSON?
- mbrumlow 10y agoI find that to be the issue. You are considering it just RAW text when it is actually formatted text that has been parsable for years with common unix command line tools. It not being in the format you consider a structured object does not mean it's not a object or even parsable. If you are using ad hoc regex I suspect you are not using all the tools available to you. I feel like Kernighan and Pike do a much better job of explaining than I could ever. https://www.amazon.com/Unix-Programming-Environment-Prentice-Hall-Software/dp/013937681X/ref=sr_1_1?ie=UTF8&qid=1471543239&sr=8-1&keywords=The+UNIX+Programming+Environment https://www.amazon.com/Unix-Programming-Environment-Prentice...
- madmax96 10y agoSo much this. What the M$ community fails to see is that text streams can be consumed by __everyone__. We've basically all accepted the fact that programs are used longer and in different ways than we'd expect. A brittle object model can only lead to vendor lock in and indigestible output.
- ygra 10y agoNothing prevents me from changing those objects into a text stream. In fact, it's infinitely easier than turning a text stream into objects.
- bad_user 10y agoFYI IronRuby never made it into a usable state, never came close to other implementations like JRuby or Rubinius and IronPython hasn't received an update since the end of 2014, which for an open-source project like a language implementation means it's nearly dead. That said adopting Ruby or Python as a shell language wouldn't make sense. Especially Python with its white space aware syntax, I mean can you imagine piping commands at the command line using Python, as I can't. These languages haven't made it as shell replacements in UNIX either, even though everyone complains about Bash.
- z3t4 10y agolately i use nodejs and have replaced the cmd tools with node modules. It is more verbose then piping shell commands but easier to understand and the same script can be reused across platforms.
- Ind007 10y ago> If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to do the heavy lifting. or Lua?
- krylon 10y agoHehe, I was so happy when I came across a Lua module for Windows administration. And so sad when I found out it was meant for Windows NT 4.0 administration. :( A current reincarnation of such a module would be really sweet, though.
- kazinator 10y ago> PowerShell to be an answer to a question nobody asked. It's conceivable that people working in the MS World who have built up (or inherited) a base of PowerShell code are asking, "what would it take to run this on Linux, or at least some of it in some way?" Of course programmers who don't currently work with the PowerShell at all are probably not asking "I want the PowerShell on Linux" in any significant numbers.