Weekend Scripter: Why Learn PowerShell?


Summary: Microsoft Scripting Guy, Ed Wilson, talks about why to learn Windows PowerShell.

Microsoft Scripting Guy, Ed Wilson, is here. Every once in a while, I am asked, “Why should I learn Windows PowerShell?”

To be honest, that is always a bit of a troublesome question. Not because I cannot answer it, but because to me the question is nearly irrelevant. I will confess that I love using Windows PowerShell. I use it every day, and when I am not using it, I am actually thinking about it.

Recently, I was getting dressed to head out to the gym, and a Windows PowerShell command popped into my head. I called the Scripting Wife and asked her for a pencil and a piece of paper so I could write the command down before I forgot it. I then scurried out to the gym, and when I returned, I tried the command and it worked perfectly. Cool. I ended up using it as a PowerTip.

So what is the problem with answering the question, “Why learn Windows PowerShell?” Well, it is that I am not certain I ever asked myself this question. I assumed I would learn it as soon as I first heard about it. But then, I guess everyone is not like that. So I decided to look at the issue from two perspectives: “Why not learn Windows PowerShell?” and “Why learn Windows PowerShell?” First of all, let me look at why not learn Windows PowerShell.

Don’t learn Windows PowerShell

Don’t bother learning Windows PowerShell if you already have scripts for everything and you can perform all of your automation needs with those existing scripts. I mean, really. There is absolutely no reason to translate a perfectly working VBScript, Perl script, or T-SQL script into Windows PowerShell if you don’t need to do so.

The purpose of writing a script is to avoid work, and if the process generates more work, then, dude, don’t bother. There are probably a few shops that are in this state. They have highly developed automation systems in place, are not on the cutting edge of technology, and are perfectly happy with what they do, how they do it, and the capabilities it provides. If you find yourself in this situation, don’t bother learning Windows PowerShell. It will not do you any good.

If you are planning on leaving the IT profession in, let’s say, the next six months, then you can probably escape from having to learn Windows PowerShell if you have managed to do so to this point. I am not picking on the senior IT pros who are waiting to retire. I hope that I am talking about the some young person who has decided that rather than learning a new technology every year and staying abreast of current trends in the profession, they would rather chuck it all, move to the Caribbean and open a dive shop. I would much rather teach scuba diving, and spend my days floating around and photographing eels, sharks, giant groupers, and various coral heads, than writing Windows PowerShell script any day of the week. And as I said earlier, I love Windows PowerShell. But compared to scuba diving all day long? Forget it.

You might not want to bother learning Windows PowerShell if your particular piece of technology does not have Windows PowerShell coverage. Of course at this point, I am not sure I could think of what that technology may be. But hey, it might exist. With complete access to the .NET Framework, WMI, ADSI, and the Win32 API, it is pretty hard to image that you might have a technology that Windows PowerShell cannot talk to. But if you do, then it probably is not worth the effort to learn Windows PowerShell.

Learn Windows PowerShell

If you have more than one system to manage, and if that system runs a version of the operation system that was created since about 2003, you really should learn Windows PowerShell. But maybe you used to use VBScript or Perl to manage your systems. Fine—see the above section. But if you find yourself needing to create new scripts, or to do new things to your system, you should begin incorporating Windows PowerShell. This is because VBScript has not been improved since Windows XP came out, and Perl is not even standard in the Windows build environment.

How hard is it to learn Windows PowerShell? Windows PowerShell can be as easy to learn as finding the Windows PowerShell console or the Windows PowerShell ISE, opening it, and typing Get-Process. This one command provides information about all the processes running on your local system. To retrieve them from a remote system, you use Get-Process –ComputerName mycomputer. That is it. It is that simple. Of course, it gets harder. The thing is that after you learn the basics, they transfer to other Windows PowerShell cmdlets and to other technologies.

There are lots of resources to help you learn about Windows PowerShell. One of the best ones (and it is free) is the Hey, Scripting Guy! Blog. Published seven days a week, twice a day, it is the single largest collection of Windows PowerShell information on the Internet. Of course, there are also local user groups, online user groups, Twitter feeds, Facebook groups, and resources via Linked In. In addition, there are hundreds of videos on YouTube related to Windows PowerShell. It is not a problem to find helpful information—the problem is sifting through the plethora of resources. But hey, that is better than not finding anything by a long shot.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Comments (2)

  1. Very insightful. I am already automating with ps.

Skip to main content