Microsoft Windows PowerShell Step by Step
Ed Wilson
Copyright 2007 Ed Wilson (Content); Ed Wilson (Sample Code)
Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at .
Microsoft, Microsoft Press, Active Accessibility, Active Desktop, Active Directory, ActiveMovie, ActiveStore, ActiveSync, ActiveX, Age of Mythology, Authenticode, BackOffice, BizTalk, ClearType, DataTips, Developer Studio, Direct3D, DirectAnimation, DirectDraw, DirectInput, DirectMusic, DirectPlay, DirectShow, DirectSound, DirectX, Excel, FrontPage, IntelliMouse, IntelliSense, Internet Explorer, J/Direct, Jscript, Liquid Motion, MSDN, MS-DOS, Outlook, PivotChart, PivotTable, PowerPoint, Rushmore, SQL Server, Visual Basic, Visual C++, Visual FoxPro, Visual InterDev, Visual J++, Visual SourceSafe, Visual Studio, Win32, Win32s, Windows, Windows NT, Windows PowerShell, Windows Server, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners.
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred.
This book expresses the author's views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Acknowledgments
Books of this length, or for that matter, even very short books, do not happen automaticallynor do they arrive in a vacuum. If the book being contemplated is about software that is not even released dude, you are going to need some help. One of the cool things about writing more than a dozen books is that, through the years, I have developed a stable of friends (nice for a guy named Mr. Ed), loved ones, technical mentors, and coworkers who have all taken an interest in the writing process and have wanted to help out.
The number-one person well, actually, there are several number-one persons that need thanking. The one I had better thank first is my wife, Teresa. This poor girl, an accountant by training, has become the de facto scripting expert in her company. Why, you may ask? Other than the fact that she is married to me and sees me walking around aimlessly from time to time, she has had the privilege of reading four books on scriptingnot once, but many times. What about this book on Windows PowerShell? Well, she has read it at least three times. Of course, I would not dare say that if you find problems, it is her fault! No way!
There are several other number one-persons I need to thank. My agent, Claudette Moore of the Moore Literary Agency, for instance, needs thanking. If not for her efforts, my book never would have been published by Microsoft Press. She is also a good person to talk to when I need encouragement.
Another number-one person to thank is Martin DelRe, my acquisitions editor at MSPress. This guy is awesome! I love talking to him. He is such a believer in the power and message of scripting that he has devoted a sizable portion of his titles to scripting. It is very rare to deal with an acquisitions editor who is as knowledgeable about scripting, networking, and the like as is Martin. The best compliment I have ever received from an editor came from him. He said, "Your book looks good. I think I will take it home and read it this weekend." My best friend didn't even say that!
The other number-one person I need to think is Maureen Zimmerman. She worked so hard to keep the book on track, and I was in 14 different countries last year while writing the book. There were time zone issues, VPN issues, language barrierslanguage barriers, did I say? Yes. Not between me and Maureen, but between me and the keyboard in the concierge lounge in Vienna, or Munich, or London, or Sydney, or this place. Do you know how hard it is to find the @ key while trying to use American input on a German keyboard? I ended up opening Notepad and typing every key on the silly thing until I found it then I cut and pasted it. Hey, better than getting locked out of your e-mail.
This book had some awesome assistance from other people as well. First among them is Jit Banerjie, a consultant for Microsoft in Australia. Technically, I am his mentor. But I always learn more when talking to him than I think he ever learns from me. Whenever I would get stuck trying to figure out something in Windows PowerShell, I would type a quick e-mail to him "Hey Jit! Help! I need to figure out how to do. " Sometimes it worked. Other times, well, he is on the other side of the world from me most of the time unless I happen to be in Canberra, then I just show up at his door step looking hungry (his wife is a great cook).
Then there is the PowerShell Community Extension project. One of the awesome things that the Microsoft Windows PowerShell team did was to make PowerShell extensible. There is a guy named Keith Hill who is working with this project. He gave me permission (along with some of his other cohorts) to include the PSCX version 2.0 on the CD with this book. This is awesome! Interestingly enough, one of my other tech reviewers (on my first VBScript book) was Alex Angelopoulos, and wouldn't you know it, he is working with the PSCX guys on extending Windows PowerShell. This is very cool. Then there were Oisin Grehan, Matt Hamilton, jachymko, Reinhard Lehrbaum, and Mark Maier, all of whom worked on this project, and without their permission, I would not have been able to include PSCX on the CD. If you ever see one of them, say thanks.
Bill Mell, MCSE, and Terry Lawson, MCSE, reviewed the labs for the book. They have been working with me since my book on Netmon many years ago.
I need to thank Dr. Tobias Weltner for allowing me to include the free version of his PowerShell IDE in my book. Every time I go to Germany, someone in one of my classes will ask me: "Do you know Dr. Weltner?" Now I can say, "Sure, he let me use his PowerShell IDE in my book!"
Then there is Ivan Giugni, the product manager for Power Gadgets. He was good enough to make sure I got the latest build of Power Gadgets for the book. Do you want to produce some impressive-looking output from Windows PowerShell? You need to use Power Gadgets. The scripting guys love Power Gadgets. The Windows PowerShell team love Power Gadgetsbecause they are cool.
I also need to thank Alexander Riedel from Sapien for allowing me to include a demo version of Primal Script 4.1 with my book. Primal Script has always been an awesome script editor, and now with support for Windows PowerShell, it is even better.
I need to thank the Microsoft Scripting Guys: Greg Stemp, Dean Tsaltas, and Peter Costantini for allowing me to include their VBScript to Windows PowerShell conversion guide as . This is an awesome document and represents hundreds of hours of work. I included it in my book because I wanted to always have it close by. Okay, you are looking at me strangely. You mean you don't always carry a copy of a scripting book around with you? Hmmmmm.