Windows PowerShell Cookbook, 3rd Edition.pdf

(16581 KB) Pobierz
THIRD EDITION
Windows PowerShell Cookbook
Lee Holmes
1110590669.005.png
Windows PowerShell Cookbook, Third Edition
by Lee Holmes
Copyright © 2013 Lee Holmes. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles ( http://my.safaribooksonline.com ) . For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com .
Editor: Rachel Roumeliotis
Production Editor: Kara Ebrahim
Proofreader: Rachel Monaghan
Indexer: Angela Howard
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrator: Rebecca Demarest
October 2007:
First Edition
August 2010:
Second Edition
January 2013:
Third Edition
Revision History for the First Edition:
2012-12-21
First release
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Windows Powershell Cookbook , the image of a box tortoise, and related trade dress are trademarks
of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-32068-3
[LSI]
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Part I. Tour
A Guided Tour of Windows PowerShell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Part II.
Fundamentals
1.
The Windows PowerShell Interactive Shell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.1. Run Programs, Scripts, and Existing Tools 19
1.2. Run a PowerShell Command 23
1.3. Resolve Errors Calling Native Executables 24
1.4. Supply Default Values for Parameters 26
1.5. Invoke a Long-Running or Background Command 28
1.6. Program: Monitor a Command for Changes 32
1.7. Notify Yourself of Job Completion 35
1.8. Customize Your Shell, Profile, and Prompt 36
1.9. Customize PowerShell’s User Input Behavior 39
1.10. Customize PowerShell’s Command Resolution Behavior 40
1.11. Find a Command to Accomplish a Task 43
1.12. Get Help on a Command 45
1.13. Update System Help Content 47
1.14. Program: Search Help for Text 49
1.15. Launch PowerShell at a Specific Location 50
1.16. Invoke a PowerShell Command or Script from Outside PowerShell 52
1.17. Understand and Customize PowerShell’s Tab Completion 55
1.18. Program: Learn Aliases for Common Commands 59
1.19. Program: Learn Aliases for Common Parameters 61
iii
1110590669.006.png 1110590669.001.png 1110590669.002.png
 
Zgłoś jeśli naruszono regulamin