PowerShell in Depth, Second Edition
Don Jones, Jeffery Hicks, Richard Siddaway
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.com2015 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: Karen MillerCopyeditor: Liz WelchProofreaders: Toma Mulligan, Andy CarrollTypesetter: Dennis DalinnikCover designer: Marija Tudor |
ISBN: 9781617292187
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 MAL 19 18 17 16 15 14
Brief Table of Contents
Table of Contents
Praise for the First Edition
A thorough look at PowerShell from three of the best writers in the PowerShell community.
Mike Shepard, Solutions Architect Jack Henry & Associates
The most wonderful PowerShell administrative guide.
Kais Ayari, PowerShell Expert, Microsoft
Another great PowerShell book for my desk!
Thomas Lee, PowerShell Consultant, PS Partnership
Hicks, Jones, and Siddaway have come together to deliver the ultimate PowerShell resource.
James Berkenbile, Principal Consultant Berkenbile Consulting
I have many books on my shelves. This is one that will be on my desk!
Trent Whiteley, Software Engineer, Fiserv
The authors know their audience and never lose sight of their readers. They use their knowledge and understanding in very clever ways to help readers understand even complex subjects.
Rolf berg, Platform Architect Active Directory, SEB
An end-all, be-all resource in the working mans hands. I can finally give Google a rest.
Eric Stoker, Network Administrator, Spokane Teachers Credit Union
Hands-down the best PowerShell book to date. The authors are some of the most respected in the PowerShell community and this book illustrates why! These guys know this stuff inside and out.
Adam Bell, Solution Architect, ZOE Systems Pty Ltd.
Priceless, practical guidance.
Klaus Schulte, System administrator, www.kvwl.de
Preface
Windows PowerShell is viewed by many IT professionals as a necessary evil, but 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, but the truth is that PowerShell 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 also 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 fourth version of a product offers substantially more features and benefits than the first, and PowerShell 4.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.1 and Windows Server 2012 R2 as operating systems for the cloud, then PowerShell 4.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, Andy Carroll, 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 Arthur Zubarev, Braj Panda, David Moravec, Jan Vinterberg, Jim Gray, Lincoln Bovee, Michel Clomp, Nick Selpa, Stuart Caborn, and Wayne Boaz.
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.
JEFF would like to thank the members of the PowerShell community who make a book like this possible. He would also like to thank his coauthors for making this one of the best authoring experiences possible.
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 time zones makes for some interesting conversations.