Learning PowerShell

So this is my year for learning PowerShell.

I think I should answer the question, “Why PowerShell?”

PowerShell Hello World
I am a big fan of the Unix philosophy of small programs that do one thing and do it well. Further you should be able to write lightweight scripts that chain those little programs together to perform larger tasks.

This granularity allows admins and sophisticated users to perform useful work without resorting to a compiled language.

One of the keys is that these programs have inputs and outputs that allow the output from one to be piped to the input of another. In Unix everything is passed around as text. In PowerShell everything is passed around as .Net objects.

Each of those approaches has strengths and weaknesses.

The strengths of passing .Net objects are:

  1. Objects can have methods as well as properties

  2. TONS of .Net objects already exist and can be accessed with PowerShell

  3. The bulk of Windows developers work with .Net.

The strengths of passing text around are:

  1. Text is easily understood by virtually any programming language

  2. Nothing exotic needs to be marshaled or parsed.

  3. XML and JSON are text…

I couldn’t pick a clear winner between these two approaches. They each have merit.

If you really, really want to stick to the pure Unix approach you can install the awesome Cygwin, but with it I definitely get the feeling that Windows and Windows apps want to see my passport before doing business with me. I am a stranger in a strange land for sure.

PowerShell has the advantage on Windows of being a native citizen. Microsoft has mandated that server software must work with PowerShell in order to ship. That is a strong incentive to learn PS!

As more and more of Microsoft’s server technologies rely on PowerShell, I suspect more and more folks will decide to move it up their list of technologies to learn.

My journey to learn PowerShell is just beginning.