Windows PowerShell Cookbook by Lee Holmes. Published by O’Reilly ISBN0596528493
Lee Holmes is a developer on the PowerShell team and is renowned for his blog at http://leeholmes.com/blog/. This book has quotes on the back cover from both Jeffrey Snover and Bruce Payette and in one respect I’m afraid I have to disagree with both of them.
Ha – bet that’s got your attention!!
The PowerShell Cookbook follows the format of other books in this series. A set of short, very well explained answers (and in this case a script) to solve a particular problem. The book comprises 26 chapters in four sections. Part I covers a quick tour of PowerShell, what it is and what it looks like plus a few fundamental concepts. Part II follows straight on covering how to use and configure your PowerShell environment, how to use the pipeline which is one of the most fundamental concepts in PowerShell and something that gives it much of its power. This section continues with various language elements including looping and flow control, variables, strings, and maths. Each of these sections is presented as a series of tasks – instant answers to the "How do I do….." questions.
Part III is where the book really kicks in with chapters covering working with files, the Internet, scripting, arrays, user interaction, tracing and error handling and security among other topics.
The last third of the book covers using PowerShell with the file system, the registry, event logs, processes and services, Active Directory, Exchange 2007 and Operations Manager 2007.
In all of these chapters a set of problems are defined and then the PowerShell script that solves the problem is listed and discussed. The problems are all real world examples of the sorts of things that users of PowerShell will find themselves needing to do. Obviously not every possible situation can be covered but the examples are such that the concepts explained in the scripts can be applied to solve other problems.
The book supplies scripting solutions to the problems – it does not assume that any of the PowerShell add ins or extensions are installed.
The last 80 pages of the book cover a set of Appendices that are absolutely invaluable. I could make a case that the book is worth buying for the appendices alone! They cover
- PowerShell Language and environment – one of the best quick reference guides I’ve seen
- Regular Expressions
- PowerShell Automatic Variables
- Standard PowerShell verbs – no reason not to get your scripts named correctly now
- Selected .NET classes and their uses – invaluable for someone starting to branch into .NET use with PowerShell, helps to find what you need to use in the mass of information available
- WMI reference
- Selected COM objects and their uses
- .NET string formatting – best explanation I’ve seen
- .NET date time formatting
All in all this is a superb book and I would recommend it to anyone using PowerShell – newcomer or expert – you will find lots of useful information. The expert user will be intrigued by some of the solutions – I know I found some ahhh – thats how that works type moments as I was reading.
Buy it. Read it. Use it.
Oh you want to know my disagreement. Both of those fine gentlemen said it should be on every PowerShell users book shelf. I think it should be on your desk, open and in use. Its the sort of book you keep turning back to – "Now how do I do that again………". There that wasn’t so bad.
Superb book. And the script examples can be downloaded so you don’t need to type them in.