charlie's blog

Thursday, July 18, 2013

why you should learn powershell

Are you already a user of Powershell? You should be, if you work with Windows at all. Microsoft describes Powershell thus:
Windows PowerShell® is a task-based command-line shell and scripting language designed especially for system administration.
That description is accurate but it really only scratches the surface. I would say Powershell is useful for anything from simple repetitive tasks to complex scripts or even full-on programs. For instance, my wife and I took a trip a few years ago, and we both took several hundred pictures with our respective cameras. I wanted to be able to put the pictures in an online album and have them arranged in proper chronological order. My pictures had names like P123456 and hers had names like CIMG1234; for both cameras the numeric part would increment with each picture. The problem is that standard alphabetic sorting would result in her pictures and mine staying separate. Enter Powershell: with one line of typing I was able to rename all the pictures so that an alphabetic sorting would properly show the pictures in chronological order.

That's probably not enough to sell you on the idea, so here's a slightly more structured pitch:

It's great for customer support
Whether your customers are the normal kind (the ones that pay you in dollars) or the informal kind (the family members that pay you in cookies), Powershell is great for customer support. All recent versions of Windows come with it already installed, so if you know how to use it, you have a ready-made tool for solving problems. No extra work required. This can be a life saver if you don't have access to your regular geek toolkit.

You don't have to be a programmer
Powershell was designed to be used by non-programmers. You don't have to understand all the rules of C# or Java, you just have to understand a few simple concepts and be willing to experiment. You can also find tons of recipes online and in print for solving different problems. You'll find you can do amazing things with very little typing.

It will make you smarter
If you already know how to program, Powershell will help you learn to think in different ways, since working with the object pipeline is comparable to functional programming, whereas most programmers do imperative programming. Or you can stick to what you know and write it like it's C. Or you can mix and match!

It makes a great bridge to "serious" code
Since Powershell is built on the .NET platform, it easily connects to existing C# components. This means that you can do anything that the huge .NET Base Class Library can do. It also makes a great tool for automating large applications, especially if you take the time to build proper cmdlets.

There you have it - four good reasons to learn Powershell. What are you waiting for?