Foreword

As someone who has written, or contributed to, more than a dozen books, I am well aware of the incredible amount of work and monumental commitment of time and resources involved with writing a book. That someone would choose to do this at essentially the same time one is burning the midnight oil while developing one of the most exciting products in Microsoft’s history, bespeaks a most committed person. However, more than simple commitment is involved. From my conversations with Lee, I can tell that he is passionate about Windows PowerShell. He sees the revolutionary changes that are introduced with the 2.0 release of the product. If Windows PowerShell 1.0 was the concept, Windows PowerShell 2.0 is the answer. If Windows PowerShell 1.0 was the vision, Windows PowerShell 2.0 is the reality. If Windows PowerShell 1.0 was for early adopters, Windows PowerShell 2.0 is moving into the mainstream.

With the inclusion of Windows PowerShell 2.0 in Windows 7, and Windows Server 2008 R2, we are beginning to see the sense of commitment Microsoft is making to the product. That the SharePoint, SQL, Exchange, Active Directory Domain Services (AD DS), Internet Information Server (IIS) teams and others have all made cmdlets should tell you that Windows PowerShell is not a passing fad. Windows PowerShell questions are already cropping up on Microsoft Certification Examinations, and as a network administrator, or a consultant you will need to learn Windows PowerShell.

Learning Windows PowerShell need not be tedious, boring, or exhausting. In fact, you will be joining a community that is at least as passionate about Windows PowerShell as Lee, (or the rest of the Windows PowerShell team), or myself (who writes the Hey Scripting Guy! blog 7 days a week – the only Microsoft blog to do so by the way). What other product from Microsoft has inspired a half dozen songs to be written about it? Not from the marketing department, but by people who fell in love with Windows PowerShell, or better yet to use the community term: became addicted.

I attended a recent SQL Saturday in Charlotte, North Carolina because I wanted to meet and to interact with members of the Windows PowerShell community. That is right, there is a huge group of hard-core SQL Administrators who are adopting Windows PowerShell due to the cool server management capabilities. In addition, a project known as the SQL Server PowerShell Extensions (SQLPSX) module (available from CodePlex), has wrapped much of the SQL Management Objects (SMO) into more than 30 useful functions. This provides ease of use for people who are not experts with SQL SMO and Windows PowerShell. By leveraging modules, the community is taking advantage of one of the great new features of Windows PowerShell 2.0. In fact, there are more than 200 Windows PowerShell projects on Codeplex. One person presenting at SQL Saturday stated the active Windows PowerShell community was one of the great strengths of Windows PowerShell. You are not alone when it comes to learning and to implementing Windows PowerShell.

I do not own every Windows PowerShell book ever written. I have probably looked at most Windows PowerShell books, but I found some of them redundant and some others confusing. However, a few of the Windows PowerShell books are essential. Lee's 1.0 version of this book fell into that later category. I keep it within arm’s length of my desk and grab it often. I have highlighted certain sections, dog-eared others, and placed sticky tabs on the more essential pages. Over the past couple years, Lee's Windows PowerShell Cookbook has grown to look more like a skinny porcupine on a bad hair day, than a typical scripting book – and that is a good thing, because his book is not a typical scripting book; it is a cookbook. Just like a “real cookbook” that contains recipes for meals, I find myself thumbing through this fascinating volume when I am hungry to try something new with Windows PowerShell.

In reviewing Lee's upgraded Windows PowerShell Cookbook, I see that I will not be placed on a diet of “foo” and “bar,” instead, there are such tasty morsels like Get-PageUrls: a way cool script that illustrates using regular expressions to extract URL’s from a download web page. It even fixes relative URLs so that they include the server from which they originated. All this happens faster than you can say “super useful” three times.

I found chapter 15 on Debugging to be well worth a careful read. Lee has a number of real good points, the premier one being do not make the mistake in the first place. This echoes my own best practice. Of course, mistakes are made, errors are introduced, and that is when the debugger commands are called upon. Windows PowerShell 2.0 ships with some great debugging cmdlets, and Lee has some extremely cool scripts to simplify the process, or at least to reduce some of the tedium. I really like the Watch-Expression script because it automatically displays the values of expressions you wish to track.

If chapter 15 on Debugging is worth a careful read, chapter 19 is worth a sticky tab because you will find yourself coming back to this chapter often. Security and script signing is a subject of much debate in the Windows PowerShell community. You will want to hear about security from the horse’s mouth. A common question I receive when giving presentations on Windows PowerShell is how can I invoke a command as another user without switching contexts? The genesis of this question is, of course, the Unix sudo command. Lee has a useful script named Invoke-ElevatedCommand that allows you to accomplish this task – most excellent.

One other thing you need to read about is the Windows PowerShell Integrated Scripting Environment (ISE) (chapter 20). A common request for years was for Microsoft to write a script editor. For years, I have been telling people we did write a script editor – Notepad. The Windows PowerShell ISE is much better than Notepad. Not only is the Windows PowerShell ISE a great script editor in its own right, but the Windows PowerShell team also exposed an object model that allows you to modify its behavior and to configure it to work in the way you wish to work. Lee has a whole section in chapter 20 that talks about the ISE, and how to modify it.

Working with Files, Directories, the Registry, Services, Processes, WMI, Remoting, Transactions and Event Handling – it is all in this book. I am not going to go over all that, because I do not want to spoil the plot. Suffice it to say, that once this book sees print, it will rapidly join its dog-eared younger brother in that small collection of Windows PowerShell books that I consider essential.

—Ed Wilson

Microsoft Scripting Guy, Author of: Windows PowerShell 2.0 Best Practices

You must sign in or register before commenting
*
*
*
*
*

Atom Icon Comments on this page or Comments on the whole book.