Tài liệu Windows PowerShell Programming P1 - Pdf 86


Kumaravel ffirs.tex V1 - 01/09/2008 8:43pm Page iii
Professional
Windows PowerShell

Programming
Snap-ins, Cmdlets, Hosts, and Providers
Arul Kumaravel
Jon White
Michael Naixin Li
Scott Happell
Guohui Xie
Krishna C. Vutukuri
Wiley Publishing, Inc.
Kumaravel ffirs.tex V1 - 01/09/2008 8:43pm Page ii
Kumaravel ffirs.tex V1 - 01/09/2008 8:43pm Page i
Professional
Windows PowerShell

Programming
Preface xvii
Introduction xix
Chapter 1: Introduction to PowerShell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2: Extending Windows PowerShell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter 3: Understanding the Extended Type System . . . . . . . . . . . . . . . . . . . . . . 29
Chapter 4: Developing Cmdlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Chapter 5: Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Chapter 6: Hosting the PowerShell Engine in Applications . . . . . . . . . . . . . . . . . 165
Chapter 7: Hosts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Chapter 8: Formatting&Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Appendix A: Cmdlet Verb Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

Published simultaneously in Canada
ISBN: 978-0-470-17393-0
Manufactured in the United States of America
10987654321
Library of Congress Cataloging-in-Publication Data
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any
means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections
107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or
authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood
Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be
addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317)
572-3447, fax (317) 572-4355, or online at
http://www.wiley.com/go/permissions
.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties
with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties,
including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended
by sales or promotional materials. The advice and strategies contained herein may not be suitable for every
situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting,
or other professional services. If professional assistance is required, the services of a competent professional person
should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an
organization or Website is referred to in this work as a citation and/or a potential source of further information
does not mean that the author or the publisher endorses the information the organization or Website may provide
or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may
have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress
are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and
other countries, and may not be used without written permission. Windows PowerShell is a trademark of Microsoft

debug.exe
from 64-bit Windows. As a member of the PowerShell team,
he wrote the language’s first production script, when he converted the team’s test harness from Perl to
PowerShell script in 2004. When he’s not working (or writing about work) he’s either sailing or playing
with fire in the backyard. You can contact him at
[email protected]
.
Michael Naixin Li is the Senior Test Lead working on the Windows PowerShell team and currently
oversees the testing of Windows PowerShell 2.0. Before Windows PowerShell, Michael worked on vari-
ous major projects at Microsoft, including the development of MSN 1.x and 2.x, quality management for
the COM Services component in Windows 2000, NetDocs Web Client Access, Web Services in Hailstorm,
and Software Licensing Service in Windows Vista. Before joining Microsoft, Michael was an assistant
professor at Shanghai University of Science and Technology (now called ShanghaiUniversity).Heholds
a Ph.D. in Computer Science from Colorado State University.
Scott Happell has been working as a software engineer and tester for 10 years. Three of those years have
been on the Windows PowerShell team, which was what brought him to Microsoft from New Jersey,
where he worked at an Internet startup that went belly-up. Scott recently left Microsoft to become a
recording engineer/rock star and is trying to find cool ways to use PowerShell to help him create music.
George Xie was a Senior Developer in the Windows PowerShell team for three years, mainly focusing
in the area of snap-in model and scripting language. Recently George joined Windows Mobile organi-
zation for the Mobile Device Management product. Before joining Microsoft, George worked for Siebel
Systems Inc. for several years.
Krishna Chythanya Vutukuri is a Software Developer working on the Windows PowerShell team. Before
Windows PowerShell, Krishna worked on various projects at Microsoft, which included the development
of Windows Presentation Foundation. Before joining Microsoft, Krishna held various product develop-
ment positions at Hewlett-Packard India Software Operations and Wipro Technologies. He holds a M.Sc
(Tech.) in Information Systems from Birla Institute of Technology and Science, Pilani, India.
Kumaravel fauth.tex V2 - 01/07/2008 10:17pm Page vi
Kumaravel fcredit.tex V1 - 01/07/2008 10:18pm Page vii
Credits

Tear Down the Barriers to Development 2
A Quick Tour of Windows PowerShell 3
Cmdlets 3
High-Level Architecture of Windows PowerShell 9
Host Application 9
Windows PowerShell Engine 10
Windows PowerShell Snap-ins 10
Summary 11
Chapter 2: Extending Windows PowerShell 13
Types of PowerShell Snap-ins 13
Creating a Standard PowerShell Snap-in 14
Writing a PowerShell Snap-in 14
Registering Your PowerShell Snap-in 17
Listing Available PowerShell Snap-ins 19
Loading a PowerShell Snap-in to a Running Shell 19
Removing a PowerShell Snap-in from a Running Shell 20
Unregistering a PowerShell Snap-in 20
Registering a PowerShell Snap-in without Implementing a Snap-in Clas 21
Saving Snap-in Configuration 22
Starting PowerShell with a Saved Snap-in Configuration 22
Using a Profile to Save a Snap-in Configuration 23
Creating a Custom PowerShell Snap-in 23
Writing a Custom PowerShell Snap-in 23
Using a Custom PowerShell Snap-in 25
Summary 27


Nhờ tải bản gốc
Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status