11 ms·
Jeffrey Snover and the Making of PowerShell
- adamgordonbell 2y agoHost here, thanks for sharing. PowerShell faced extreme opposition at Microsoft, and its creator Jeffrey Snover was demoted for pursuing it. Jeffrey was originally brought into Microsoft to help MS learn how to compete in the data center, but culturally they were so tied to the personal computer model of the world, that they fought him every step of the way. Edit: Another interesting thing, is how Powershell exists because Windows isn't file based. Jeffrey's goal was server administration, but on Windows you can't just edit files to administer things, you need to call various APIs and get structured data back forth. The rich object model fell out of that. It was the only way. ( Also, apologies if the transcript has errors. I've gone from professional transcriptions to Descript and then a pass of GPT4 trying to find the right punctation breaks and then me doing a quick read through. I don't think its coming out as high quality as I'd like. )
- hobs 2y agoAnd as far as I can tell its no longer a priority at MSFT, reading the complaints from the MVPs on Github about how MSFT promised a bunch of further investment that has not been realized, changes not implemented, good stuff just sort of left to rot on the vine. I loved powershell with (some of) its weird warts, but I have moved on.
- pletnes 2y agoMy biggest gripe is that some Azure stuff seems to be available only through powershell, which is hard to install and configure (I think) in certain corporate policy-infested environments.
- Uvix 2y agoThe Az PowerShell module just uses HTTP APIs, so anything they do can be done with other tooling if you really want to. (There’s also the Az CLI tool, which I don’t like as much as the Az PowerShell module but might be easier to manage in an environment like that.)
- ExoticPearTree 2y agoYes, true, they call APIs. But for whatever reason, MS decided that instead of documenting those APIs they went on the route of abstracting them in PS modules or the az-cli submodules that its mind boggling.
- RajT88 2y agoThe REST API is documented. Maybe not completely so, but mostly. https://learn.microsoft.com/en-us/rest/api/azure/ https://learn.microsoft.com/en-us/rest/api/azure/
- nullindividual 2y agoThe Azure CLI [0] is a viable method of managing Azure infrastructure if you don't/cannot use PowerShell. [0] https://learn.microsoft.com/en-us/cli/azure/what-is-azure-cli https://learn.microsoft.com/en-us/cli/azure/what-is-azure-cl...
- pjmlp 2y agoActually Azure CLIs are kind of schizophrenic, in typical MS fashion. You have Azure Powershel Cmdlets (the old 5.1 based, and the new Powershell Core based), AZ CLI (in Python), AZD CLI (in Go). The only one that offers full power is actually the AZ CLI one, e.g. some Kubernetes features aren't exposed in the others.
- RajT88 2y agoIf it exists in Powershell, it is backed by a REST API. Lots of AZ SDK's include a helper method to make calling the API's easier (like az rest cli command or invoke-azrestmethod).
- mike_hearn 2y agoThere have been regressions even. PowerShell 7 isn't backwards compatible with PowerShell 5 and some features that used to exist are just gone with no plan for a return, due to (surprise) fights between .NET and Windows teams over API metadata formats or something. Most incredibly Microsoft situation ever. Say what you want about bash, at least it doesn't pull stunts like that.
- JoBrad 2y agoAre there any currently-supported versions of Windows that don’t support Powershell Core? I recall installing it on Windows 2012, even. > Say what you want about bash, at least it doesn’t pull stunts pile that. I guess it depends on what you consider to be included in the terminal’s domain? There are entire papers and guides on which commands are considered safe (sometimes only when run in a very specific way), and which variants, alternatives, etc. you should use instead, for Bash scripts, because of the inconsistency in what a command evaluates, does, and returns for various distros. That’s not to hate on Bash, but just to point out that it’s not a strength of Bash vs PS.
- sllabres 2y agoWhen Powershell was first released I was primarily working with Unices and was very curious what would work better: The Unix way in cutting, changing and grepping some part of stdout (in some OS a bit simplified b with options for automated pricessing which commands the programm to output colon delimited or otherwise formatted) Or the Powershell way where on can access data members directly. I thought I would prefer the second method more, because the access looked much cleaner/structured. But after all these years (still mostly Unix scripting but Powershell and some other environments too) my mind has changed. Would like to hear what others would prefer' Unix method with some scripting language or windows method with Powershell)
- chaps 2y agoCombining both powershell and unix is neat!
- 2y ago
- valiant55 2y agoWhat have you moved on to? I don't think I could go back to bash after learning PowerShell and no longer parsing string output.
- hobs 2y agoPretty much all python, dicts work just as well over here.
- JoBrad 2y agoI’m curious about the scenarios that Powershell used to work for you in, and what tooling you’ve moved on to. Do you use something else for Write-Once-Run-(Nearly)Anywhere type scripts? I primarily write Powershell Core scripts for scenarios where I need to execute the same commands on a variety of operating systems, and I know that the script is likely to be maintained by your “typical” sysadmin (highly technical, but not a programmer)in an environment where installing runtimes for programming languages is discouraged. I switched to macOS as my daily driver about 2 years ago, so PS fits these scenarios pretty well, and Powershell Core updated fairly regularly. Sure there are annoying bugs and misses with the built-in and add-on MS modules: networking cmdlets are an almost total miss, Get-LocalGroup (and maybe other commands?) is totally broken on some AzureAD-joined machines, and the Azure and MgGraph Powershell modules still don’t have enough coverage to move on from the legacy Windows Powershell modules (or even to rely on just one of them, for areas they supposedly cover). But overall I’ve been pretty happy that 99% of the time I can write a powershell script once, and it will run on any machine with Powershell Core, in a consistent way.
- hobs 2y agoDon't do as much "local" sysadmin stuff as most of the workloads moved to the cloud and containers, and that's all automateable via APIs which are much nicer to work with in python with its useful library support. (one of the biggest misses in powershell) There's still a lot of good stuff wrt powershell maintainability by normal humans (though the entire mental model of object output usually throws them for a loop for years) managing local stuff.
- pjmlp 2y agoPowerShell has the whole Windows OS libraries, COM and .NET available, without additional installation, a bit more than just Python.
- hobs 2y agoAbsolutely, and the calling conventions for all those pieces of code make no sense to powershell folks :) If you have a background in windows dev or any of those tools then yeah, easy mode go grab your tools, but for most people doing system automation the calling conventions and complete lack of discoverability within the powershell ecosystem (and their tools in no way helping out) made this not a realistic use case. Shoot I have seen some powershell modules that have to embed string C#s and eval thing just to have basic performance or other basic use cases.
- hypercube33 2y agoYou can tell by WinGet which is a new product not even close to supporting anything PowerShell by design and almost being anti PowerShell with its overly verbose output. Which is odd since it's right up powershells alley being a management cli tool
- briHass 2y agoThere is a Winget client module for Powershell. I used it the other day to write a one liner that could upgrade all with exclusions. I didn't want to pin, because I still wanted to see updates I'm skipping.
- vips7L 2y agoDoes anyone even use winget? I tried but its repositories never have the tools I need in it. Scoop has been superior for me in every way.
- 5636588 2y agoUniGetUI (formerly WingetUI) is a really great tool since it supports multiple package managers. https://github.com/marticliment/UniGetUI https://github.com/marticliment/UniGetUI
- StressedDev 2y agoI have found it useful. I used to install PowerShell 7.x, kubectl, Bicep (Azure language for deploying resources), etc. It works fine. The biggest problem I have is I cannot use it to install helm because the helm package is not shipped by the helm team (I don't trust packages shipped by third parties).
- vips7L 2y agoYeah for the things they have its great, I've just found that they lack a lot of stuff. To this day they still don't have Apache Maven in the repository. I just use scoop, I've found that its repositories just have way more tools and it's way easier to contribute to.
- 2y ago
- lhamil64 2y agoWhat have you moved on to? I have to use Windows at work and PowerShell is way better than basic cmd, even better with Windows Terminal. I suppose you could probably install bash or another unix-y shell but that seems like it wouldn't be as integrated with Windows.
- vb-8448 2y agoI wonder why they chose to build something from scratch instead of using python or similar tools that existed before.
- lozf 2y agoThat was a great listen, thanks.
- 7thaccount 2y agoIf anyone from MS-PWSH team reads this, I'd love for y'all to add some basic GUI functionality that doesn't involve me having to write a bunch of .NET. I'm sorry, but the reason I like PWSH in the first place is it's a simple dynamic language with lots of easy to use commands that I can chain together. I'd love to have a new set of cmdlets for creating simple user interfaces and charts. For example, something like the below would be so simple for Microsoft to add to the product and remove a page of boilerplate code that I don't really understand well. Create-Chart -Type "Bar" -XAxis $Cities -YAxis $GDP -OutputFile "C:/Documents/ProjectAnalysis/CitiesBarGraph.png" There are probably users in the millions that are ok at the basics of programming, but don't have the job role to where tools like Java or C# make sense. Python is usually a good fit here, but I really wish Microsoft had something written for us common folks and not just server admins and IT folks. If Microsoft put some more effort into PWSH to where it wasn't turtle slow at things like parsing files and then started adding things like what I talk about above. Maybe even cmdlets for statistics and science...it could be something pretty amazing that your typical business analyst could quickly use to build some really amazing software to do their job better or a prototype for the software team to actually implement in a more robust manner. It's such a really cool technology that has a lot of missing potential IMO. It seems like Microsoft assumes that the three options are full software developer with C#, IT stuff with PWSH, or Excel for the business folks. Excel is really great in a lot of ways, but it is also pretty limited and VBA+Excel is one of the most limited ecosystems I've dealt with. I guess third party languages like Python, R, and so on make for another fourth option, but sometimes I wish Microsoft had spent more time in this area.
- RajT88 2y agoYou are looking for something like Kusto then.
- 7thaccount 2y agoA query language? I don't think that's what I'm referring to at all if I found the right links. Business users can use SQL quite easily and tools like Powershell or Python make automating that easy.
- bloopernova 2y agoAs someone who prefers to read interviews and articles rather than listen, I really appreciate you providing a transcript. Thank you!
- thiht 2y ago> I've gone from professional transcriptions to Descript and then a pass of GPT4 trying to find the right punctation breaks and then me doing a quick read through. I don't think its coming out as high quality as I'd like. I tried reading the transcript and couldn’t reach the end, it’s a bit hard to read in my opinion. I assumed it was machine generated while reading it, but I can’t say why specifically. Maybe it needs a bit of editing to be easier to read. Thanks for the effort anyway, it’s still better than no transcript :)
- adamgordonbell 2y agoIts funny, because professional transcriber will get the same words. But with better choosen paragraph breaks, and sentence splitting and dropping filler words where it hurts readability. Hard to get right, it seems.
- heresie-dabord 2y ago> the transcript has errors. I've gone from professional transcriptions to Descript and then a pass of GPT4... [...] I don't think its coming out as high quality as I'd like. I wondered why there were so many unintelligible passages. I found it laborious to decipher. Thank you for explaining.
- darksim905 2y ago>PowerShell faced extreme opposition at Microsoft, and its creator Jeffrey Snover was demoted for pursuing it. That makes me sad. The dude is absolutely brilliant. Awesome post!
- arunsivadasan 2y agoWould have loved to hear why he made the move to Google considering that he became a Technical Fellow and very popular in the community
- justanother 2y agoI have never, and I mean never, been a Windows user, even though I've been using computers since 1982. During the rise of Wintel in the early 1990s, I followed the rise of Linux and 386BSD. When Win95 and NT ruled the business desktop in the late 1990s, I sought refuge in SPARCStations, Linux, and discontinued NeXT hardware. After the turn of the century, I adopted the newly-POSIX-compliant Mac OS. All this to say, avoidance of Microsoft products has been a cornerstone of my computing policy for nearly half a century (with the notable exception of Applesoft BASIC). But PowerShell? PowerShell's nice.
- neves 2y agoYou posted just at the same time I asked. What's makes PowerShell better than bash?
- oblio 2y ago1. Structured data passed along pipelines. 2. Automatic introspection/command completion for command parameters, even user-created commands. You can argue about a lot of other things Powershell does, but these 2 things are things which if Bash were designed today by 100 top notch software developers, would probably be part of 95 of their designs.
- heresie-dabord 2y agoYou have long experience in computing and especially in the innovative currents that shifted the paradigm. Cheers! Your first paragraph creates expectation that the second paragraph disappoints, though. Would you explain why you think PowerShell is "nice"?
- justanother 2y agoIt's a way of using Windows that is very tolerable to POSIX commandline diehards. The similarities are numerous and include enhanced scriptability and even small details like up-arrow command history. You could get all of that with Cygwin, but Powershell adds tight OS integration, access to COM objects (or whatever we're calling them this year) as well as the remoting of objects. It's a useful and powerful shell that reminds me of VMS DCL and csh.
- evacchi 2y agoI love corecursive! Keep up the good work @adam!!
- neves 2y agoI've always been curious to know. I am an experienced Bash developer, and when PowerShell was released, I was very excited. Finally, we would have a cool shell on Windows for development. However, since then, I've never managed to grok PowerShell and continue to use my good old Bash even on Windows. What is the experience of other developers who are experts in both shells to compare them? Did PowerShell really fulfill the promise of being a more efficient and modern shell? Or people just use it because it is already installed and better than CMD?
- pletnes 2y agoExactly my experience.
- langcss 2y agoI find it is in a weird spot where it is more powerful than bash but you often don't need that power or if you do coding in c# might be better. It is very good of you want to work with Azure though. You probably don't want to use bash for that. But lots of reading up each time I use it. Bash is my go to for small jobs or a command line experience. I am not an expert in either but have used both plot to get stuff done.
- simooooo 2y agoMost times if I’m doing anything suitably complex it ends up as a little C# app rather than powershell.
- prmoustache 2y agoWell I used powershell a lot when I was managing VMWare infra. Ultimately the force of a object oriented shell is in the ecosystem, I haven't found any other use case where powershell was useful to me. I am pretty sure it is useful in an Azure context too but in the last few years I have never been in a situation where I would feel the need to install powershell on my linux workstation to use a specific module/use case.
- sebstefan 2y agoI've done a lot of Bash, read some books about it, I'm a firm believer that nobody should be writing anything complex in bash. Above the ballpark of 50 lines I consider it a code smell. I have this web page saved up in case I ever need to convince anyone of this. http://mywiki.wooledge.org/BashPitfalls http://mywiki.wooledge.org/BashPitfalls I used Powershell recently and not having to wrangle with text (commands return objects) makes it a much easier scripting language, and command line language. The fact that they have an official way to handle argument parsing is excellent, everything is unified and the commandline window is able to have autocompletion for literally every option of everything. Bash could never even dream of having that. It is incredible and makes you extremely productive. But type coercion manages to introduce new ways to create bugs that Bash didn't have. Honestly at this point I prefer PWSH but still kinda dislike both. I'm waiting for the new natural evolution.
- spicyusername 2y agoI'll agree with some of the other sentiments here that whenever my career brought me close to Windows administration I absolutely loathed the experience. PowerShell however was actually pretty great to use, despite everything else on Windows being extremely clunky. It always felt very thoughtfully designed. Linux is great, and I'll always use it as my daily driver for work, but using bash is absolutely horrible. But because it's always everywhere, it's something that everyone reaches for first, and so we'll probably still be dealing with bash scripts in 2100, warts and all.
- zlies 2y agoI love this podcast!
- useerup 2y agoSo much was so right about PowerShell. But it failed to attract a wider audience, and in their quest to woo Linux devs Microsoft has been undermining PowerShell lately. Knowing what PowerShell offers, falling back to bash CLI tools feels like two steps back. Just some of the stuff PowerShell did right: - PowerShell cmdlets are self-describing and rich in information. Rather than each command doing its own parsing of parameters, cmdlets describe parameters and delegates the actual parsing to the shell. The shell understands data types, parsing rules, e.g. how to parse a UUID or a date. Not only does this ensure a consistency that was never in *sh shells, but it also enables cool stuff like e.g. autocomplete, predictive input, help instructions etc. almost for free. - "Simulation" mode (-Confirm and -WhatIf) where a cmdlet can describe the action it is about to take, and the mode of the shell may decline everything (effectively a "simulation mode") or may actually ask the user for permission (-Conform) for each action. But, alas, PowerShell never caught on outside Windows, and now MS is leaving it to wither in their quest to not upset a wider non-Windows community.
- iso8859-1 2y agoNushell is based on it, and it is picking up steam. https://www.nushell.sh/book/ https://www.nushell.sh/book/ So in the end, PowerShell doesn't need to catch on.
- vips7L 2y agoNushell isn’t anywhere near as powerful as PowerShell.
- ripley12 2y agoI think it depends on what you want to do. Nushell's never going to surpass PowerShell for Windows infrastructure automation. But if you want a shell that makes it easy+quick to work with data in all kinds of formats, Nushell wins IMO.
- rr808 2y agoI used to be a hardcore Windows dev but never figured out powershell. I actually ended up writing scripts in C# and had a utility to load and run it.
- martinsnow 2y agoGood news. You can write C# that powershell will compile on the fly. It's so ingrained in Microsoft applications that even MSSQL Server will do it as well, if you want to go down that route.
- oblio 2y agoHow?
- martinsnow 2y agoExecuting C# in Powershell: https://blog.adamfurmanek.pl/2016/03/19/executing-c-code-using-powershell-script/index.html https://blog.adamfurmanek.pl/2016/03/19/executing-c-code-usi... Executing C# in SQL Server: https://learn.microsoft.com/en-us/sql/language-extensions/how-to/call-c-sharp-from-sql?view=sql-server-ver16 https://learn.microsoft.com/en-us/sql/language-extensions/ho... An anecdote: about 7 years ago I made an postal code lookup function for SQL server, that would parse a csv from the danish postal services, that was retrieved from a HTTP GET in T-SQL, then parsed with C# to get the city from a postal code. It was a project i did for fun at school.
- rqtwteye 2y agoThat's what they should have done. Have a C# interpreter with maybe a few extensions for shell stuff. Powershell is not a good .NET language and not a good shell. It's just a weird beast. A while ago I worked on a project to do pretty complex configuration on Windows machines. Everybody thought Powershell would be perfect for this. It turned into a complete nightmare with tons of oddities to work around. I myself barely can make sense of the code and I bet nobody else can. Next time I would do either Python or write the whole thing in C#.
- johng 2y agoI once had 2 microsoft engineers call me for help with qmail because I was active on the qmail mailing list. They couldn't wrap their heads around how svc and daemontools worked.. the good old days! I never asked why 2 microsoft engineers were working with qmail. I think I was 20 at the time and I was just happy to be on the phone with people from Microsoft even though I was very much a Linux guy.
- axpvms 2y agoPowerShell helped me a lot in my earlier career, bash always felt like banging rocks together in comparison.
- alganet 2y agoPowerShell is very comfortable in interactive mode. For scripting, I don't get it. It's not designed to be a simple text-based glue like the bourne shell is, so it feels weird in many places (quoting, escaping, even more than sh is). It's very good for glueing Windows stuff though, like .NET libraries and so on.
- mike_hearn 2y agoHuh I always found that to be the opposite. PowerShell is clearly designed to be a programming language not an interactive environment. E.g. 'wget' exists but run it on its own and it doesn't save the file to disk or print it out, it prints an object as a table, which is about the most useless output possible. I know why this happens but that doesn't make it helpful. Reading about the dysfunction inside Microsoft makes it clear why it ended up this way though!
- alganet 2y agoI don't want an object oriented language to glue stuff, I want a glue language. Want the result of wget in memory instead of print or disk? Write it to memory: page_contents="$(wget -O- some_page)" It doesn't try to apply some default structure, so I don't need to rely on MS doing a fancy special wget for me that calls thousands of lines Invoke-WebRequest in the background.
- nunez 2y agoDoes the ISE still take forever to spin up?
- gavindean90 2y agoI think everyone just uses VSCode now
- briHass 2y agoThe ISE is deprecated, and MS guidance is that it should be uninstalled. Defender endpoint management flags it as a mild security risk.
- jiggawatts 2y agoSomething that is under-appreciated is that if you need to write your own command-line tool with a "proper" programming language such as C/C++ or whatever, then there is a vast difference in productivity between writing for traditional shells or PowerShell. I've never been able to make a generally useful CLI tool in under a few thousand lines of messy code. You typically have to deal with: pipeline inputs, optional parameters, parameters with values, defaults with overrides, "dry run" mode, and the various output formatting requirements, and so on. You end up with 90% fluff and 10% action. With PowerShell, a C# module is basically 20 lines or so of overhead, and the rest is all action. It's mindblowing how productive this is! You get parameter validation, parameter name tab-complete, pipeline input, pipeline output, formatting, strong typing, globbing, etc... all for free.
- theimposter 2y agoWhile I've never used C#, I agree with you. I've moved more and more to compiled or interpreted languages versus CLI tools for maintenance and administration.
- nu11ptr 2y agoPowershell wasn't awful when I wrote it but I never understood why arrays of length 1 removed the array and become the contained type. This caused a huge # of bugs as you suddenly had to care how many items could potentially be in the array and check each time you modified vs. handling them generically. Does anyone know WHY they did this?
- sgbeal 2y ago> Does anyone know WHY they did this? That sounds like a classic case of software trying to be "too clever," nine times out of ten of which will invariably backfire. As a software developer, one should always resist the temptation to make their software "too clever."
- AndrewDucker 2y agoAgreed. This drives me crazy. You have to work around it in a script of any complexity. It's probably my least favourite thing about PowerShell.
- JoBrad 2y agoThis is so annoying. I’ve started using the preceding comma hack to force an array. $Ary = @(, "value") One cool feature for creating arrays (especially larger arrays, for performance improvements over using +=) is to assign your array to a for loop. It wasn’t an obvious method of populating an array to me, but is definitely handy. $Ary = foreach ($Obj in $Objs) { @{ foo = $Obj.foo } }
- jmull 2y agoI think @("value") is enough. I use [array]$Ary = "value"
- Arnavion 2y agoI haven't used PS in many years, but I do remember `@("value")` would still end up unwrapping the single-element array back into its element in some situations, and the only sure-fire way to get an array was `, "value"` or `@(, "value")`
- theimposter 2y agoPowerShell, is still the best way to scale your workload, administering a Windows server environment on premise. For Azure, there were features that were present in the Graph API that were not in PowerShell. I haven't checked back in a while, but I think most new features in PowerShell are just pointing back to the Graph API.
- Pet_Ant 2y agoHonestly I love Powershell and run it on Linux or OS X. Being able to access fields instead of having to play with `cut` to get the data I want is priceless. Just feels cleaner and more maintainable.
- nunez 2y agoI met Snover at a DevOps Days forever ago. We were talking about PowerShell, and I didn't know he was at our table. Super nice dude.
- munchler 2y agoThis is a great story of finding a way to be productive inside a giant, impersonal machine like Microsoft. That said, it did nothing to convince me to invest more mental energy in PowerShell. Every time I use it, I have the same “meh” reaction: The learning curve is too steep and the syntax is too ugly. It doesn’t ever “stick” with me, so I end up starting from zero every time I encounter it again. I think the fundamental problem is that PWSH inhabits a dark valley between quick-and-dirty scripting and I’m-serious-about-this programming. It really needed to pick one side or the other to win people over, but never did.
- jodrellblank 2y agoPowerShell is MIT licensed, cross-platform Windows, Linux, macOS compatible, and you can download it in various installers and packages here: https://github.com/PowerShell/PowerShell/releases https://github.com/PowerShell/PowerShell/releases for anyone who wants to try the newer version on Windows, get either Windows Terminal (from Microsoft Store or Github releases: https://learn.microsoft.com/en-us/windows/terminal/install https://learn.microsoft.com/en-us/windows/terminal/install) or Visual Studio Code. The classic Windows' command prompt console host engine just can't do Unicode and fonts and colours and Unix shell escape sequences. After that, find something which will immediately trigger you to froth at the mouth, hurry onto some Microsoft forum and post about how Microsoft is the devil. Here's some popular choices, many of them valid complaints: ('curl' and 'wget' on Windows override the real programs with M$ imposters). (gci doesn't support the parameters of either dir or ls). (aliases work differently to Unix shells). (almost everything works differently to Bash). (gci -recurse is frustratingly slow). (it doesn't have a CLI text editor like nano). (you don't understand that GNU and Unix utilities aren't "Bash"). (PowerShell remoting with enter-pssession and invoke-command aren't SSH). (there isn't any sudo because Windows isn't Linux). (Execution policies are annoying). (it doesn't use UTF8 everywhere always). (backslash, the one true Unix escape character isn't PowerShell's escape character). (Line endings aren't Unix line endings). (having to use sigils to disambiguate between shell and code is worse than Python for coding and worse than Bash/cmd for shelling). (You want > to be both numeric comparison and/or Unix shell IO redirect and it's not). (you hate Verb-Noun and the one true way is Noun-Verb). (byte streams don't pipeline well or quickly). (It's verbose which you hate, but the elastic syntax one-liners are unreadable which you hate, it should have exactly the right amount of verbosity which coincidentally is exactly the amount you are comfortable with). Moving on from there, avoid falling for the tempting usermode filesystem equivalent, which is abandoned and only exists for backwards compatibility making everything slower. Avoid falling for the declarative host config system Desired State Configuration (DSC) which is semi-abandoned and only hangs around for backwards compatibility. Control your enthusiasm about .NET/C# LINQ in a shell, because nope. Prepare yourself for the weirdness of a programming language which has shell style dynamic scoping instead of lexical scoping, shell style output handling where all output goes to the pipeline, pipeline obsessed array unrolling which spills the contents of containers all over the floor if you aren't paying attention, having to learn that there's more to output than just stdout and stderr and that the host and pipeline are different outputs, and that there's a lot of non-powershelly .NET and Windows stuff poking through everywhere. Prepare your armoured-toe boots for a large number of footguns and bugs in what is an intricate and complex shell/scripting language mashup. Moving on from there, it's a REPL: $x = 5 $x + 3 Numeric literals in hex and binary: 0xff 0b1010 Strings in single quotes are literal: 'foo $bar' Strings in double quotes are not literal: $bar = 'hello' "foo $bar $( 4 + 3 )" It's a shell: ping google.com It's introspective: gcm ping # get-command details of ping gcm p* # commands starting with pi help gcm Function calls don't use () or "return" because shell-style usage and behaviour, variable names and function calls aren't case sensitive: PS C:\> function test($Left, $Right) { $left + $right } PS C:\> test 4 6 10 PS C:\> test -Left 4 -Right 6 # named parameters PS C:\> test -L<ctrl+space> # autocomplete Reach for .NET libraries: PS C:\> [System.Ma<ctrl+space> # autocomplete to explore and find System.Math PS C:\> [System.Math]::<ctrl+space> # autocomplete to find e.g. [System.Math]::Pow(4, 5) Basic data types: $array = 1,2,3 $array | foreach { $_ } $hash = @{KeyA = 4; KeyB = "b"} $hash.keyC = 5 $hash['keyD'] = get-childitem $x = 'KeyA' $hash.$x # oooh on Windows: gci | ogv # out-gridview Text filter ("grep ish"): gc words.txt | sls '[iou]' # get-content and Select-String Objects: ls | select Las<tab> # tab complete will pickup the available properties # on the objects coming through the pipeline, where possible ls | select LastWriteTime, FullName # two properties, kept separate, no text parsing ls | % {$_.LastAccessTime.DayOfWeek} # the access time is a .NET System.DateTime, # not a timestamp or text string. ipcsv data.csv | select col1, col3 # import-csv, select-object $hash = @{KeyA = 1; KeyB = "foo"} [pscustomobject] $hash # casting (Objects are used as containers for multiple properties and keeping them separate; it's not a full "object oriented programming with inheritance and interfaces" kind of shell/language, although it has some nods to that).
- rcarmo 2y agoI am not a fan of PowerShell, but I am a fan of Jeffrey--he toiled and talked sense at a time way before Azure was a thing, but everything since he shipped has proven he was right.
- UweSchmidt 2y agoPowershell was truly a product of Microsoft monopolistic confidence. To create a language that allows absolutely no syntactical carryover from any other langauge is wild. You couldn't guess or assume any command, parameter or flag. Even with Microsoft's ambition they should have realized that legions of admins and programmers had to learn and maintain scripts in both Powershell and bash for a few decades at least. The extreme verbosity of the syntax may look good for a presentation to the committee, but dealing with it regularly collides with well-researched and understood limits of the human brain, where information of a certain size, and delays of a certain length break the state of flow and requires concentration, explicit memorization and double-takes. Even with practice one could never quickly execute the common shell incantation to turn a thought into reality, instead one would have to wrestle with syntax, even if it's just waiting for autocomplete to appear and deciding to accept the next word of a multipart command. Let's try the start menu and search for "pow..", chose between 4 amazing options, Powershell or Powershell ISE, both in regular and x86 flavour. Either would take a while to load, breaking flow. The ISE shows a little splash screen that jumps to a second location. Another dialog shows up and informs you that you've closed the last session without saving the unnamed script files. But it opens them anyway, as you would expect. So why scold me for this? Because, you know damn well that saving the textfile is trouble: I can type or copy, and then execute any kind of evil code imaginable, but saving the file and then running it as a .ps Script triggers the ridiculous execution-policy song and dance. Probably trauma from Microsoft's bad security reputation of early Internet Explorers and Windows versions. I tried to love it anyway but one day my script encountered filenames with square brackets. Powershell implicitly interpreted those [1] and [2] as iterators somehow (https://stackoverflow.com/questions/21008180/copy-file-with-square-brackets-in-the-filename-and-use-wildcard https://stackoverflow.com/questions/21008180/copy-file-with-...). Sorry but dealing with files is the one job a scripting language has, filenames are beyond the control of script authors, and the space of valid filenames on Windows should be known. This gave me some long lasting trust issues with that language. (The Azure team aparently had enough power within Microsoft to create their own, sane and readable syntax: "az find vm", "az account show".)
- oblio 2y ago> Powershell was truly a product of Microsoft monopolistic confidence. To create a language that allows absolutely no syntactical carryover from any other langauge is wild. You couldn't guess or assume any command, parameter or flag. Even with Microsoft's ambition they should have realized that legions of admins and programmers had to learn and maintain scripts in both Powershell and bash for a few decades at least. Um... no. Powershell was inspired by shell, Perl and a bunch of other languages, you see it in its design. The other part was just a desire for consistency, since *NIX knowledge is just brute forced. Yeah, -v is generally verbose and -h is generally help, but in practice you can't rely on anything.
- DrTung 2y agoI think PowerShell is a bit scary, for example I could never get curl to work in it, say a simple POST command: curl -X "POST" google.com should return Error 411 (Length required) from google (as it does in CMD.EXE) When I try it in PowerShell I get: Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'. and some more error messages even curl -X "GET" doesn't work :-(
- skowalak 2y agoThat is because `curl` is an alias for the builtin Invoke-WebRequest and not the actual curl program. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/module/microsof...
- martinsnow 2y agoWell that's just plain stupid
- gabrielsroka 2y agoIt was at one point, but they took it out because it was stupid.
- saghm 2y agoIt says a lot about the uphill battle that he faced when the first two sentences Jeffrey says in the podcast are "By the way, is it okay to swear?" and "You know, I had executives say, ‘Jeffrey, exactly which part of fucking Windows is confusing you, Jeffrey?’".
- bluedino 2y agoUnless I'm interacting with some Windows subsystem, and need the specific Powershell commands, I just think "why the fuck am I not using Python?" It's also way too verbose and slow for 90% of the stuff I'd use Bash for (or would have used Perl in another life) I often wonder why Microsoft didn't base it on Python, Node, or something else. I can't remember when PS was first released so I'm not sure what would have been ideal at the time.
- oblio 2y agoPowershell predates Node by 3 years. They probably didn't base it on anything else since they control .NET. I doubt it's slow because of .NET, it's slow because of either its design or because of under-investment in performance. However... which version of PS are you using? As far as I remember the newer versions are quite fast.
- dopylitty 2y agoPython's default REPL is godawful. It's also just not designed for the kind of console work that PowerShell excels at because you have to do things like managing file handles rather than just getting the file content and piping it to another command. PowerShell is great because it's a swiss army knife that has a very nice REPL with autocomplete, no weird whitespace behavior, readline[0], and can do anything .NET can do if you need to do anything more complicated. Plus it's object oriented so you can focus on doing the tasks you actually need to do rather than trying to figure out how to use archaic utilities to parse the text based output of other archaic utilities. 0: https://learn.microsoft.com/en-us/powershell/module/psreadline/?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/module/psreadli...
- thesuperbigfrog 2y ago>> I often wonder why Microsoft didn't base it on Python, Node, or something else. I can't remember when PS was first released so I'm not sure what would have been ideal at the time. They originally based it loosely on Perl and the Korn shell. In the first edition of "Powershell in Action" by Bruce Payette there is a sidenote that states: 'PowerShell uses the "at" symbol ("@") in a few places, has $_ as a default variable, and uses "&" as the function call operator. These elements lead people to say that PowerShell looks like Perl. In fact, at one point, we were using Perl as a root language, and these elements stem from the period. Later on, the syntax was changed to align more with C#, but we kept these elements because they worked well. In Perl terminology, they contributed significantly to the "whipupitude quotient" of the language.' It also states: 'The core PowerShell language is based on the POSIX 1003.2 grammar for the Korn shell. Originally, Perl idioms were appropriated for some of the more advanced concepts such as hash tables. However, as the project progressed, it became clear that aligning PowerShell syntax with C# was more appropriate.'
- ilrwbwrkhv 2y agoBig fan of PowerShell. Such a shame that being in Microsoft, you aren't allowed to do great work. That is why hackers shouldn't join large companies. You can create much more value working for yourself or joining a small startup.
- low_tech_punk 2y agoThe Monad Manifesto mentioned in the podcast: https://jsnover.com/Docs/MonadManifesto.pdf https://jsnover.com/Docs/MonadManifesto.pdf
- meisel 2y agoWhy wouldn’t they just replicate bash or some other UNIX shell, along with the basic UNIX tools like cp and find with matching APIs? Huge mistake there imo, even if they did add a few bells and whistles with powershell
- eigenvalue 2y agoSeems so weird in retrospect that Microsoft wouldn’t have seen the value of an easily composable and programmatic way to configure anything in Windows and their other important enterprise applications like Active Directory and Exchange. The idea that connecting with Remote Desktop and clicking around with a mouse was suggested as an alternative strikes me as absurd. Especially because automating that sort of thing (at least based on my experience using autohotkey and window spy) is horrendously difficult and annoying.
- akira2501 2y ago> an easily composable and programmatic way to configure anything in Windows There's an entire industry of consultants and software vendors that don't want that outcome. > connecting with Remote Desktop and clicking around with a mouse This generates a lot of hours. > is horrendously difficult and annoying. It is ironic that this is probably the main reason that alternative operating systems even exist.
- generalizations 2y agoPiling on, it's that industry of consultants and software vendors that keep windows in use. Microsoft protects those consultants, and those consultants protect Microsoft's market share.
- jen20 2y agoEven crazier is that the “click around” mentality made its way into azure too - back in the day (a decade ago, to be fair) I had a serious suggestion from a technical support agent there that the best way to automate some setting was with Selenium…
- siriushacker 2y agoFavorite line: "I’ve never seen anybody use a GUI in a clever way. Ever. There’s no cleverness to it. No, like, Oh my God, you should see the way Adam clicked that mouse. Oh my God. Guys, guys, guys, guys, come on, check it out. Adam’s going to click the button. Oh my God. That’s amazing. It just doesn’t happen."
- aragonite 2y agoTo be fair, a GUI can be used in a very clever and skillful manner. It's called keyboard shortcuts (and, to a lesser extent, mouse gestures). You can't deny an Excel world champion uses its GUI in a highly impressive way. And features like multiple carets editing (as popularized by Sublime Text) makes it possible to perform some remarkable editing feats. :)
- dwoldrich 2y agoAt $dayjob I am blessed with the task of wrangling a 20+ year old codebase of SQL Server stored procedures. It's around 300k lines of monkey tested, business-critical code that: * wasn't source controlled * was never tuned (properly) for performance * deployed into environments by editing/executing sql in SSMS. * of course, no automated tests, etc... It's a windows shop, I am developing on a Mac, and we do linux on Github Actions. I selected tools like PowerShell Core, sqlcmd, docker for running Windows SQL Server instances, RedGate SQL Compare for extracting existing schema and code from the legacy servers, tSQLt for unit testing, TSqlLint for code compliance, SQLFluff for style compliance, and Flyway for deployments. We quickly discovered PowerShell Core was the most interoperable cross-platform scripting shell when Windows had to be one of the platforms. It wasn't pleasant to code in. The regex engine comes from .Net, which has bad catastrophic backtracking problems, and the array situation was goofy. Launching executables with any sort of control over the launch and capturing the output stream was hit or miss - I would often have to launch a process, redirect its output to a temp file, and then read the temp file after the child exited. So piping around with child's stdout into a string variable was always more trouble than it should have been. BUT, PowerShell Core executes fast (nice job M$FT, if there's one thing you do well, it's micro-optimizing!) It has nice tools for interacting with the user, like ascii art list pickers and easy input prompt generators. And, most of the strange quirks in dealing with the Windows file system are papered over if one avoids folders with locked files. Anything you want to achieve can probably be done if you search hard enough. Recommended!
- pjmlp 2y agoBesides the whole interesting story background, yet another confirmation of the anti-.NET bias by WinDev during the Longhorn efforts. Instead of uniting and having everyone collaborating into a common like Google with Android making it happen no matter what, or how Bell Labs tried with Inferno / Limbo, the active fight against .NET, and anything related. To what ended up being the WinRT failure. Ironically, WinDev is now shipping JavaScript and Webview2 all over the place on Windows 11.
- deleted 2y ago[deleted]
- desktopninja 2y agoI wonder how many engineers use AWS's Powershell cmdlets? They are incredibly well built and feel first class/more polished than a lot of AWS tools.
- imperialdrive 2y agoThanks for this. Just seeing the word "PowerShell" gets me excited every time... been using it for hours a day for years and it's so much fun. It's how I first learned to code, professionally. Kudos and Cheers!
- dangus 2y agoI found the most interesting part about this article how it kind of makes a direct line from UNIX’s place as a place for programmer system admins versus professional services-driven servers. These people at Microsoft knew that they’d wipe the floor with the professional services folks by getting that professional services cost out of the picture by providing the small UNIX-like toolbox to do sysadmin work via automations. Of course, PowerShell being API-based instead of file-based was what came out of that. It’s interesting because what has survived has essentially been Windows and UNIX (via Linux being able to drop all the proprietary baggage of UNIX solutions). Everything else that was built to sell professional services is dead.