Table Of Contentwww.it-ebooks.info
Microsoft Windows PowerShell
3.0 First Look
A quick, succinct guide to the new and exciting features
in PowerShell 3.0
Adam Driscoll
professional expertise distilled
P U B L I S H I N G
BIRMINGHAM - MUMBAI
www.it-ebooks.info
Microsoft Windows PowerShell 3.0 First Look
Copyright © 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2012
Production Reference: 1260912
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-644-0
www.packtpub.com
Cover Image by Tina Negus (tina_manthorpe@sky.com)
www.it-ebooks.info
Credits
Author Project Coordinator
Adam Driscoll Yashodhan Dere
Reviewers Proofreader
Chris Dent Linda Morris
Shay Levy
David Karapetyan Indexers
Hemangini Bari
Tejal Daruwale
Acquisition Editor
Dhwani Devater
Graphics
Manu Joseph
Lead Technical Editor
Susmita Panda
Production Coordinator
Nilesh R. Mohite
Technical Editor
Prasanna Joglekar
Cover Work
Nilesh R. Mohite
www.it-ebooks.info
About the Author
Adam Driscoll is a young and enthusiastic Software Developer and Team Lead at
Quest Software. Born and raised in Wisconsin, Adam attended Edgewood College
in Madison, WI and was hired shortly thereafter by Quest. He has experience in
authoring PowerShell modules and providers in both .NET and PowerShell, building
PowerShell development tools for developers and administrators and frequently
blogs about .NET technologies.
I would like to thank my mother and father for always believing in
me and supporting me. I wouldn't have been able to complete this
without them. I would also like to thank my family and friends for
providing encouragement throughout the process of writing this
book. Finally, I would like to thank Carrie Arnold and Shay Levy for
providing additional editorial guidance during the authoring of this
book. Their help ensured that the quality of the book was far beyond
what I could do alone.
www.it-ebooks.info
About the Reviewers
Chris Dent is an Automation Specialist with over 10 years experience working
with Microsoft and networking technologies. Chris has worked with PowerShell
since 2007 specialising in network protocols and management.
My thanks should go to my wife Emily, for her endless patience in
the face of incessant clattering from my keyboard in the evenings.
Shay Levy is a Systems Engineer working for a government institute in Israel. He
has over 20 years of experience, focusing on Microsoft server platforms, especially
on Exchange and Active Directory. For his contribution to the community he has
been awarded with the Microsoft Most Valuable Professional (MVP) award for
four years in a row. As a Microsoft Certified Trainer (MCT) he has taught numerous
courses at John Bryce training center, Israel's largest computer training center.
He is the Co-Founder and Editor of the PowerShellMagazine.com website and a
Co-Director of the PowerShellCommunity.org website. Shay was also a technical
reviewer of several books, including the Microsoft Exchange 2010 PowerShell
Cookbook from Packt publishing. He often covers PowerShell related topics on
his blog http://PowerShay.com and you can also follow him on Twitter at
http://twitter.com/ShayLevy.
www.it-ebooks.info
Not unlike many programmers David Karapetyan stumbled into programming
while trying to attain a graduate degree in a related technical field. In his case it
happened to be mathematics and while he enjoyed the abstractions and mental
gymnastics involved in proving theorems at the end of the day opening up a shell
and writing a Ruby script to demonstrate an edge case of some theorem was far
more satisfying. So after attaining a Masters degree in mathematics he entered the
field of software testing and reliability and hasn't looked back. These days his tools
for quickly accomplishing a task are C# and PowerShell. He works at eSolar as a
Software Test Engineer verifying the proper functionality of software that controls
fields of heliostats at a concentrated solar power plant. The complicated nature of
the software and its high reliability requirements mean that there must be a lot of
automation in the verification and testing process in order to meet tight release
deadlines. As the software runs on Windows the right tool for maintaining the
testing and automation framework for verifying the software is PowerShell because
it integrates seamlessly with all the components that comprise the testing framework.
www.it-ebooks.info
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to
your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print and bookmark content
• On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib
today and view nine entirely free books. Simply use your login credentials for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise on
Twitter, or the Packt Enterprise Facebook page.
www.it-ebooks.info
www.it-ebooks.info
Table of Contents
Preface 1
Chapter 1: Find What You're Looking for 5
The Show-Command cmdlet 7
Updatable contextual help 11
What help is made of 11
The Save-Help cmdlet 12
The Update-Help cmdlet 13
The Get-Help cmdlet 14
The auto-discovery cmdlet 15
Understanding cmdlet auto-discovery 17
Things to know about auto-discovery 18
Summary 22
Chapter 2: Usability Enhancements 23
The problem with Where-Object and ForEach-Object 24
Fixing the problem with Where-Object 25
Fixing the problem with ForEach-Object 29
Enhancements to tab completion 31
Improvements to Get-ChildItem 34
The problem with Get-ChildItem 35
A better Get-ChildItem 37
Summary 40
Chapter 3: Improved Administration 41
Scheduling jobs 42
Creating a job trigger 44
Viewing scheduled jobs in the Windows Task Scheduler 46
Delegated administration 48
www.it-ebooks.info