Author: Richard Siddaway
Publisher: Manning, 2010
Pros: Succeeds as a cookboook
Cons: Neither logical nor clear
Reviewed by: Alex Armstrong
This is the first book to convince me that PowerShell is a good idea. The problem I've got with PowerShell is that it seems like overkill for a scripting language and insufficient for a full applications language. In short I've never been very sure why we need yet another programming language targeting admins and other casual programmers.
What this book does is to explain the PowerShell idea and give some of the history and motivation and this almost succeeds in persuading me that it is a useful addition to our toolkit.
Unfortunately when we hit Chapter 2 things start to go wrong. The chapter on learning PowerShell only succeeds in confusing me - and I can already program in PowerShell. There is something about the author's style that results in a constant talking around the subject. And when the code if finally presented it seems to fall out of the blue and there it is.
To be fair much of the discussion is about finding out how to use facilities to find out about PowerShell - a sort of programming by discovery. But this doesn't seem like a good way to approach any logical task like programming. I'd much prefer a logical explanation of how things work than a "explore it and see" approach.
Chapter 3 continued to confuse me with an explanation of the tools I had to hand. Using .NET and COM objects mixed up with specific APIs such as ADSI and WMI. In nearly all cases the explanations were basically "this is complicated" and yes I have to agree that WMI for example is complicated, but there is a sort of logic behind it and this is just not revealed.
The same messy thinking is displayed in Chapter 4 where the methodology of building scripts is considered. Just because you are an administrator doesn't mean you can ignore the wealth of programming methodologies that there are and just settle for "ad-hoc". This is dangerous stuff and the warnings just aren't big enough.
The second section of the book deals with specific how-to areas. Dealing with user accounts, mailboxes and the desktop. The third section is about scripts for servers, working with logs, DNS, Active Directory, Exchange, IIS, and SQL server. The book closes with a look at innovations - new ways to use PowerShell.
This "cookbook" section of the book is probably the most successful in that it takes a standard form - set a problem - solve a problem. A brief discussion of the, usually short, code presented finishes the recipe with sometimes a box out on some theory or a special point. Few of the solutions contain any serious programming a for loop or an if statement at most and are mainly about identifying the object, properties and methods needed to complete the task. Given that this subject is all about creating admin scripts this is probably how it should be - after all who needs a quicksort in an admin script.
At the end of the day this book fails to teach the reader how to write PowerShell scripts. It is not logical or clear enough for that. What it does succeed in doing is in presenting a collection of PowerShell scripts that do useful jobs. Consider it a cookbook and it's not bad - as long as you only want to do what it shows you or something very close.
Surprisingly, even though I didn't get on with this book at all well, I can recommend it if you want a PowerShell cookbook - in this role it is reasonably good.