Windows PowerShell Cookbook Review

Tuesday, 02 April 2013
  • By
  • Jeff Ammons
  • Tags:
  • PowerShell
  • Review
Picture of cover of Windows PowerShell Cookbook
I'm a fan of the Cookbook series from O'Reilly Media.

The idea is a book covering a development topic by showing you how someone experienced with that technology would solve specific problems that you are likely to need to solve yourself at some point.

I've read a number of them and they have all been very helpful.

The one I am currently reading is the Windows PowerShell Cookbook, and it is no exception.

Most books I will only review once I am finished, but the nature of a Cookbook is that you don't read it cover to cover. You look up recipes. Since this book is over 1,000 pages long I am writing the review now rather than waiting…

You wouldn't want a Cookbook to be your only book on a topic, but once you have the basics down it can be a lifesaver.

The author, Lee Holmes, works on the PowerShell team at Microsoft and knows PowerShell inside and out. I've heard Lee on podcasts speaking about PowerShell and he not only talks about what PowerShell does, but why.

A good example that flicked the switch on one of my little mental lightbulbs was his discussion of Execution Policy on the PowerScripting Podcast.

I've always found it very annoying that you have to set the remote execution policy to allow scripts to run. It seems dumb to make every person who uses PowerShell issue the command, as administrator no less, Set-ExecutionPolicy RemoteSigned (or one of the more permissive settings).

Lee explained why this is the case, and I realized that, duh, of course this was the right choice.

Yes it is true that every person who uses PowerShell will have to make this change. BUT it is also true that 99% of Windows users won't be using PowerShell. Think about that for a second. Then remember the bad old days when people would get an email that would run some dandy VBScript scripts without their knowledge that would propagate all manner of nasty malware. Imagine if that malware couldn't run because the user hadn't turned on the ability to run scripts.

If you go from 100% of users vulnerable to such scripts down to 1%, and then imagine that the 1% who are now vulnerable are probably the most likely to know how to prevent or fix the problems, then you see why we have to set our execution policy. Actually brilliant.

If you want to know how to enable scripts, see recipe “18.1 Enable Scripting Through an Execution Policy”.

This is a very thorough book. The recipes take you from very simple, generic tasks like “1.2 Run a PowerShell Command” and “9.2 Search a File for Text or a Pattern” to very complex, specific tasks like “28.7 Improve the Performance of Large-Scale WMI Operations”.

If you plan to work with PowerShell I would recommend this book as the anchor of your PowerShell library. No, seriously, this book is HUGE and would totally hold your boat in place.

Don't buy this book as your first or only PowerShell book because it is not a tutorial, but once you have read a tutorial book (or watched a video or taken a class), then you will need the cookbook.