
The Man Behind Windows PowerShell - sbrown12
https://www.heavybit.com/library/podcasts/to-be-continuous/ep-37-the-man-behind-windows-powershell/
======
kabdib
I've recently written a couple thousand lines of PowerShell.

It's a miserable language, full of unexpected behaviors and badly designed
features. Oh, it's got some interesting stuff going on, but things like:

\- including the text of 'echo' (and stdout generated by invoked tools) in a
function's result was a big surprise. You wind up piping stuff to "Out-Null" a
lot in defense of this, since a lot of Windows tools are stupidly chatty ("The
Blffgh command succeeded with status 0!") and that's awkward.

\- so was the "unwrapping" that happens when a function returns a list (return
[a,b] you get the list you want, try to return [a] and it rips off the list
and just returns the inner 'a', and I think an empty list results in null . .
. just wow).

The sole reason I use PowerShell is because it's good for mucking with OS-
level objects in Windows, stuff that I would otherwise have to write native
code to frob. And sometimes that is actually kind of attractive.

~~~
vmarsy
I agree on those 2 points.

regarding your second point, I don't like this unrolling either.

The trick seems to be instead of :

    
    
        return $mylist
    

Add a comma in front:

    
    
        return ,$mylist
    

[https://stackoverflow.com/a/16122464](https://stackoverflow.com/a/16122464)

This will make sure [a] never gets changed to a, and [] never gets changed to
$null

~~~
electricEmu
There is a slight better trick. If you specify the variable as an array, it
will always be treated as such.

For example, instead of

    
    
        return $mylist
    

...you can...

    
    
        return @($mylist)
    

The return keyword is unnecessary in PowerShell so this can be shortened to:

    
    
        @(mylist)

------
telltruth
I haven't met a single person who likes PowerShell. It's perhaps the textbook
example of ugly design that looks technically consistent but utterly
unfriendly and mind bogglingly verbose. I am not saying Windows command line
is great or bash is best, but at least those things are designed for humans at
certain extent. I have written few ps scripts and virtually every line, every
step, every task almost always required googling. I don't know anything about
Snover but my image of PowerShell designer was someone who couldn't write more
sophisticated parser and compensated that lack of skills and creativity to
solve fundamental challenges in designing OO shell by offloading complexity
and unfriendlyness on users. Basically just reverse of Steve Jobs.

It was aweful when PowerShell team tried to shove their ugly creation down
people's throats by removing Shift+right click menu for "Command prompt here"
by "PowerShell here". Not a sign of good product when you have to force it
upon people. The designers of this thing should have been demoted, let alone
making them "Distinguished Engineer".

~~~
katastic
While I'm sure that's partly sampling bias. The truth is, Powershell has a lot
of flaws. Both in the program itself, as well a the language decisions.

And I _REALLY_ like the idea of an object-oriented piping system. I would love
to have that built into Linux/bash/etc instead of every program having to have
some sort of "human readable" mode and (if you're lucky) a "machine readable"
mode. Except every machine readable mode is different and still requires a
parsing pass to get it filtered into your program correctly. I find it fun and
even relaxing to design parsing passes to bring say, smem, into a Python
script. But that's because (Thank God) I don't have to do it for a living.
[And the newest era of "some" programs supporting JSON or XML output but
there's still no easy tools for filtering through it into the next program--
requiring yet another translation layer.]

Now back to Powershell. It's fun to learn the first day. And then after that,
it's just an 80 degree walk uphill after you learn one stupid idea after
another. You want to do something insanely simple in concept and you're
pouring through ours of documentation and examples for the exact use-case.

Personally, I've started using Python2/3 for scripts lately. Most systems I
use already have Python, and Python is easily 10x-100x faster in many
situations and that's not even using a compiled variant. And while I enjoy C
variant programming, Python is still a huge step up from all those stupid Bash
idiosyncrasies like string -eq non-string but wait, you added a space before
the equals, so it explodes anyway. (I can't remember a great example off-the-
top-of-my-head, but anyone who has used Bash has had those days of an obscure
error being related to a single incorrect whitespace.)

~~~
int_19h
Object-oriented piping is actually somewhat problematic, because objects carry
behavior, not just data. This means that everyone in the pipeline now has to
agree on the semantics of that behavior - in case of PowerShell, they need to
understand and talk the .NET object model, for example.

A much more lightweight approach is to exchange structured data. This can even
be easily done on top of existing byte streams, just standardizing the format.

FreeBSD started adopting this approach via libxo for its base utilities:
[https://github.com/Juniper/libxo](https://github.com/Juniper/libxo). I hope
it spreads into Linux.

------
cjsuk
PowerShell is one of the few bits of software which has actually made me throw
a computer in anger. The idea has potential but the implementation is just
bad.

It's slow (I have to wait 5-10 second and before it responds on an i7?!?),
inconsistent (some things return local time and some UTC), unreliable (it will
just fail randomly after working for two months), has terrible memory usage
problems (try copying a large file with it via WinRM), has a terrible
scheduling and security model (scheduling something that actually doesn't barf
with errors is difficult), spooges out UTF16 randomly, and is full of nasty
surprises which are constantly lurking waiting to bite your face off.

It is entirely the opposite of what I want from a language of any kind.

That man owes me at least 3 months of my life back.

The lure is a few one liners work pretty well to start with but the moment
they turn into two liners then problems start but you're invested in it then
and it's too late.

I use python for automation now. No such problems.

~~~
danschuller
Definitely agree is very slow - even for "simple" things like echoing lines.

The one thing I do like is I can make assumptions about how the scripting
language works - like writing a if-statement for instance. This lets me write
simple scripts pretty fast. Especially compared to bash which tends to be
quite quirky and requires a lot of checking docs.

------
unkown-unknowns
At first I was a little annoyed that (on mobile) it didn't tell me the length
of the interview.

Had I known how long it was before I started listening I probably would not
have listened to it.

I am glad that I didn't know, so that I began listening.

Once I started listening it didn't take long before I was convinced that I
ought to listen to the whole thing.

Very interesting interview.

Very glad they provided a transcript also. Having both the text to read and
their voices to listen to was much more enjoyable together than would either
of those have been alone.

There were some typos here and there in the transcript but since I am on
mobile I didn't dare leave the page to point them out. Someone else will have
to take care of that to have them fixed. I do remember one error that occurred
in a couple of places was that the transcript said SANS instead of just SAN
(singular) or SANs (with a lower-case "s").

------
swasheck
This is a great line:

> On the other hand, if I'm at a lower level and in fact I'm at a really
> higher level, it takes time, but it'll eventually rectify itself.

A lot of people get wrapped up in a desired title and recognition, but the
confidence Jeffrey had to know that his work would speak for itself is
instructive. Additionally, it's not like it was instantaneous; it took 5 years
to get that rectification.

~~~
user5994461
No, it's bad advice.

If you are at a low level, you move to Facebook/Google and you come back to
Microsoft the next year. The world is filled with people who are waiting for a
raise and will not get it in the next decade.

~~~
ryandrake
Yea, I used to believe that fairy tale. "Just wait! The quality of your work
will speak for itself" is nonsense. Reality is, for every person who uses the
Hope And Prayer career development strategy, there's another person who
hustles, self-promotes, or brown-noses their way into promotion after
promotion. In most places, a raise that I get is a raise that you don't get,
so you really have to think about it as a competition.

~~~
tonyedgecombe
This is exactly why I hate working for corporations and big business.

------
youareterrible
This thread is full of people who are bad at PowerShell complaining about not
using PowerShell properly.

Learning it is one of the most important things a Windows sysadmim should do,
today. Hell, if you consider yourself a Windows power user, you should learn
it.

A single sub-1000-line script I wrote in a couple days of downtime has saved
over $10,000,000 in taxpayer dollars and has never stopped working since the
day it added itself as a scheduled task. I am not a programmer.

It's very powerful and generally limited only by your knowledge of how to do
it with PowerShell. And all you need to start and learn everything are two
commands. Three if you count update-help.

Get-help Get-command

~~~
telltruth
If you were writing bank app in COBOL on mainframe 24X7 for many decades, you
would have probably found it intuitive, productive and high value as well. The
problem is that for most people scripting is not their day to day job. It's
something you do for may be a day after you write month worth of code. If your
scripting language is ugly and unfriendly you will tend to forget it and
basically have to re-learn it every time you try to use it. That's not a good
or productive experience for people who are writing 10 lines of script after
long intervals.

------
fowl2
There's a lot of comments here about Powershell, but this podcast (with a
transcription, yes!) has a lot of other great discussion on MS's transition
from waterfall and how it's effected the people.

------
filereaper
I found it kinda cool that the foundational difference between Unix and
Windows is that Unix returns file-descriptors whereas Windows decided to give
out handles.

You can do stuff like putting callbacks on a handle to do async-io when you
have a pointer to work with.

~~~
k__
Did PowerShell really catch on?

Was this difference so good that it was incorporated on other platforms?

I really liked the idea of the PowerShell, but somehow it felt to me that it
never really became "a thing" and the Windows Subsystem for Linux move from MS
felt like they gave up on the whole shell thing in the end. :\

~~~
throwaway7645
In my small experience no. Linux is super powerful. It is darn simple to pipe
commands to each other and always know the output is text. Powershell passes
.NET objects, so even if you think you should be able to easily pass the
output from one command to another, in reality it doesn't work out nearly so
well and puts a lot of cognitive load on me for even simple things. For
complex things, the language is much nicer than BASH, but that is irrelevant
as most people aren't using BASH for the complex stuff. I use the full range
of Linux commands for simple stuff and use Python or Perl for the more complex
stuff. I really want to like PS and have put a lot of time into it, but in the
end I only see it filling the role of someone scripting the deployment of user
permissions and server configurations. So it is great for a very small subset
of IT work, but doesn't give the user the power over general OS use like Linux
does.

~~~
michel-slm
For something in-between the two the Xonsh shell might be nice. It's basically
a Python-based shell with full access to Python for scripting purposes.

I like Bash but writing anything remotely complex in it is... not recommended

~~~
throwaway7645
I'll have to check it out, but usually for the easy stuff, the standard
commands like grep + Awk is more than enough.

------
zengid
This is tangential but I really like the design for that page. The audio time-
stamps that appear next to the transcript are just awesome.

------
nunez
I met Jeffrey at a conference here in Dallas last year. Incredibly humble guy
and full of great stories. I'm happy for his success!

------
blabli
Spent about 6 months writing a 5k-ish system in powershell (using powercli for
vsphere/esx) turned out to be the most frustrating half a year of my career
and one of the worst architecture decisions I have made. Unfortunately there
weren't other viable options for integrating with vmware at that time.

------
youdontknowtho
Big fan of Snover.

------
jcadam
I've actually had to use powershell because my current employer's systems are
so locked down I can't install any other programming tools (or software in
general) and am constantly forced to find ways to workaround our freaking
useless IT department.

I have a UNIX background and I really, really, dislike doing any sort of
programming on Windows. Powershell is a giant bucket of WTF.

------
fileoffset
Windows Powershell is some kind of disgusting hybrid of Perl and Bash. It's
terrible to read and annoying to write.

------
sabujp
why is powershell so pedantic, my fingers are gonna fall off with all the
typing

~~~
electricEmu
> why is <not-my-preferred-shell> so pedantic, my fingers are gonna fall off
> with all the typing

I apologise, but your comment doesn't list any specifics to back up your broad
assertion. Do you mind expanding on, and backing up, that assertion? Your view
could apply to any technology or shell.

~~~
sabujp
[https://stackoverflow.com/questions/29887324/windows-
powersh...](https://stackoverflow.com/questions/29887324/windows-powershell-
equivalent-of-linux-ls-l)

I could go on and on

~~~
electricEmu
Hi, I see you located an outdated PowerShell question on StackOverflow. It
appears you may not be familiar with the official documentation [1].

Please feel free to take a few days and learn some PowerShell. After you feel
a little more familiar with the documentation, and have used the shell enough
to discuss, please feel free to reach out.

[1] [https://docs.microsoft.com/en-
us/powershell/wmf/5.0/feedback...](https://docs.microsoft.com/en-
us/powershell/wmf/5.0/feedback_symbolic#get-childitem)

------
feelin_googley
"I had one executive say, "Exactly what part of effing Windows is confusing
you.""

Reminds me of Dave Korn's story.

[https://news.slashdot.org/story/01/02/06/2030205/david-
korn-...](https://news.slashdot.org/story/01/02/06/2030205/david-korn-tells-
all)

See Question 5

"I think this is symbolic of the way the company works."

~~~
oblio
That's an article from 2001 about a USENIX conference from the 90's though. I
think that today at least a sizeable part of Microsoft comes from a Unix
background.

------
frgtpsswrdlame
How was that transcript created? Just lots of elbow-grease?

~~~
tcsf
We get a first-draft transcript made through rev.com, then manually
editorialize and format to make it easier to follow for folks who prefer to
read.

The player itself is built with video.js which, when combined with the ttml
format for the final transcript, allows us to provide that click-to-time
interactivity.

~~~
carussell
There's no publication date on the episode page. Right now it's only available
through a `meta property="article:published_time"` in the page source, or by
finding the episode in the series list. This makes it difficult to cite.

EDIT: I just incorporated this quote into the PowerShell article. The
transcript differs a bit, so you might want to update it. Notable differences
are the transcript's "would turn structured data" and the omission of mention
of awk, grep, and sed. (Presumably, the latter sounded like unintelligible
false starts to the stenographer, who just cut it entirely.)

Here's the quote:

> I'd been driving a bunch of managing changes, and then I originally took the
> UNIX tools and made them available on Windows, and then it just didn't work.
> Because there's a core architectural difference between Windows and Linux.
> On Linux, everything's an ASCII text file, so anything that can manipulate
> that is a managing tool. AWK, grep, sed? Happy days. I brought those tools
> available on Windows, and then they didn't help manage Windows because in
> Windows, everything's an API that returns structured data. So, that didn't
> help. [...] I came up with this idea of PowerShell, and I said, "Hey, we can
> do this better."

EDIT 2: The references to "PEARL" are all a little weird, too.

~~~
tcsf
Thanks for this, I've updated the transcript.

------
apatheticonion
Ah, the man behind why I chose macOS for my development environment. Thanks
for costing me a bunch of money mate.

