PowerShell in Depth:
An administrator's guide
Don Jones, Richard Siddaway & Jeffrey Hicks
Copyright
For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact
Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email:
orders@manning.com2013 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.
| Manning Publications Co.20 Baldwin RoadPO Box 261Shelter Island, NY 11964 | Development editor: Cynthia KaneCopyeditor: Liz WelchTechnical proofreader: Aleksandar NikolicProofreader: Linda RecktenwaldTypesetter: Dennis DalinnikCover designer: Marija Tudor |
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 MAL 19 18 17 16 15 14 13
Brief Table of Contents
Table of Contents
Preface
Windows PowerShell is viewed by many IT professionals as a necessary evil; we see it as a management marvel. The challenge from the beginning has been to wrap ones head around the PowerShell paradigm of an object-based shell. Some people view PowerShell as just another scripting language like VBScript. The truth is that Power-Shell is an automation and management engine. You can run this engine in a traditional console application, which is how most IT pros are first exposed to it. You can run it in a graphical environment like the PowerShell Integrated Scripting Environment (ISE), or through a third-party tool like PowerGUI or PowerShell Plus.
As you might imagine, the third version of a product offers substantially more features and benefits than the first, and PowerShell 3.0 fits this model. This version of PowerShell naturally builds on what came before, but it takes off from there. If you think of Windows 8 and Windows Server 2012 as operating systems for the cloud, then PowerShell 3.0 is the automation and management engine for the cloud, although PowerShell scales down to help you better manage any size environment.
Collectively, we have close to 70 years of IT experience. We have worked with PowerShell from its days as a beta product and have written on the topic for nearly as long. Our goal is to bring this knowledge and experience into a single reference book. Notice the key word, reference. This is not a how-to or teach yourself PowerShell book, although you can learn much from reading it cover to cover. Rather, this book is intended as the reference guide you keep at your desk or on your mobile device so that when you need to better understand a topic, like PowerShell remoting, you have a place to which you can turn.
We have tried to keep our examples practical and targeted towards IT professionals responsible for Windows system administration. It is our hope that this will be the book you go to for answers.
Acknowledgments
As you can imagine, a book of this scope and magnitude is not an easy undertaking, even with three coauthors. There are many, many people who had a hand in making this possible. First, wed like to thank the entire PowerShell product team at Microsoft. Many of them took time from their busy schedules to answer our questions and offer guidance on a number of new features, even while they were still being developed!
The authors would also like to thank the fine folks at Manning Publications: Cynthia Kane, Karen Miller, Maureen Spencer, Liz Welch, Linda Recktenwald, Janet Vail, and Mary Piergies. They have taken what can be a grueling process and turned it into something pleasant yet productive in helping us bring this book to publication. That is not easy.
We also thank the cadre of what we think of as real-world reviewers who offered their opinions on how we could make this a book that they, and you, would want on your bookshelf. They include Adam Bell, Andre Sune, Bart Vermeulen, Bruno Gomes, Eric Flamm, Eric Stoker, Gary Walker, Greg Heywood, Innes Fisher, James Berkenbile, Jelmer Siljee, Jonathan Medd, Kais Ayari, Klaus Schulte, Mike Shepard, Peter Monadjemi, Richard Beckett, Rolf berg, Santiago I. Cnepa, Thomas Lee, and Trent Whiteley.
We would especially like to thank Aleksandar Nikolic for his time and dedication in reviewing the technical content of our book. Aleksandar shares our desire to produce the best possible PowerShell reference and we truly appreciate his efforts.
DON would like to thank everyone at Manning for their support of, and commitment to, this project. Hed also like to thank his coauthors for their hard work, and his family for being so giving of their time.
RICHARD would like to thank everyone who has taken the time to comment on the book and the PowerShell community for their willingness to share. He would like to thank Don and Jeff for making this a very enjoyable experienceworking across eight timezones makes for some interesting conversations.
JEFF would like to extend a special thanks to Steve Murawski and Travis Jones for their PowerShell 3.0 insights. He would also like to thank his coauthors for making this one of the best authoring experiences possible.
About this Book
This book was written as a reference for system administrators. You can read the book cover to cover, and weve tried to arrange the chapters in a logical progression, but, in the end, it works best as a reference, where you can explore a topic more deeply in the chapter that is devoted to a particular subject. will tell you more about what you will learn in the book, and what you need to know before you start.
The 40 chapters in the book are arranged into four parts, as follows:
- which cover the basics associated with using PowerShell. Although we didnt write this book as a tutorial, there are a few basics youll need to explore before you can use PowerShell effectively: the pipeline, the concept of PowerShell hosts, the shells help system, and so forth. Well dive deeper into some of these topics than a tutorial normally would, so even if youre already familiar with these foundational concepts, its worth a quick read-through of these chapters.
- tackle these technologies individually, and we dive as deeply as we can into them, so that you can master their intricacies and subtleties.
- which have a single goal: repeatability. Using PowerShells scripting language, along with associated technologies like workflow, you can begin to create reusable tools that automate key tasks and processes in your environment.