没有合适的资源?快使用搜索试试~ 我知道了~
首页Windows PowerShell v2实战指南:权威全面升级版
Windows PowerShell v2实战指南:权威全面升级版
5星 · 超过95%的资源 需积分: 9 104 下载量 192 浏览量
更新于2024-07-26
6
收藏 11.11MB PDF 举报
《Windows PowerShell 实战 (第2版)》是由 Bruce Payette 所著,原书名为 Windows PowerShell in Action, 2nd Edition,是针对Windows PowerShell 2.0的全面指南。该书在保留第一版清晰易懂的基础上,深度剖析了v2版新增特性,如高级函数、模块、远程操作等,并对批处理脚本、字符串处理、COM、WMI、.NET等内容进行了大幅修订和扩展。 本书共分为两大部分:第一部分深入讲解PowerShell的基本概念和使用技巧,包括类型管理、运算符与表达式、高级运算符、脚本流程控制、函数的使用与创建、模块的应用、元编程、远程管理和调试等方面。这部分旨在帮助读者建立起坚实的PowerShell基础。 第二部分则侧重于实际应用,涉及文件操作、文本处理、XML、.NET扩展、COM集成、WMI和WS-Management管理对象、实时响应事件、安全问题等多个主题,提供了丰富的实例和场景,使系统管理员能够迅速找到实用工具和技术。 作者Bruce Payette作为PowerShell核心团队成员,以其深厚的专业背景和生动的写作风格,使得本书不仅成为学习PowerShell的权威指南,也是系统管理员的实用参考手册。读者赞誉其内容详实、易于理解,无论初学者还是进阶用户都能从中获益匪浅。无论是从零开始接触PowerShell,还是希望提升现有技能,这本书都是不可或缺的资源。
资源详情
资源推荐
CONTENTS xv
15.3 Extending the ISE 622
The $psISE variable 622 ✦ Using the Options property 624
Managing tabs and files 625 ✦ Working with text panes 629
Adding a custom menu 633
15.4 PowerShell script debugging features 638
The Set-PSDebug cmdlet 638 ✦ Nested prompts and the
Suspend operation 643
15.5 The PowerShell v2 debugger 647
The graphical debugger 648
15.6 Command-line debugging 652
Working with breakpoint objects 653 ✦ Setting breakpoints
on commands 656 ✦ Setting breakpoints on variable
assignment 657 ✦ Debugger limitations and issues 658
15.7 Summary 659
Part 2 Using PowerShell 661
16 Working with files, text, and XML 663
16.1 PowerShell and paths 664
Providers and the core cmdlets 664 ✦ Working with
PSDrives 665 ✦ Working with paths that contain
wildcards 667 ✦ Suppressing wildcard processing
in paths 668 ✦ The -LiteralPath parameter 670
The Registry provider 671
16.2 File processing 672
Reading and writing files 674 ✦ Writing files 679 ✦ All
together now—reading and writing 680 ✦ Performance caveats
with Get-Content 680
16.3 Processing unstructured text 681
Using System.String to work with text 681 ✦ Using hashtables to
count unique words 684 ✦ Using regular expressions to
manipulate text 686 ✦ Searching files with the Select-String
cmdlet 688
16.4 XML structured text processing 693
Using XML as objects 693 ✦ Adding elements to an XML
object 695 ✦ Loading and saving XML files 697
Processing XML documents in a pipeline 701 ✦ Processing
XML with XPath 702 ✦ A hint of XLinq 709 ✦ Rendering
objects as XML 711
16.5 Summary 717
xvi CONTENTS
17 Extending your reach with .NET 719
17.1 Using .NET from PowerShell 720
.NET basics 720 ✦ Working with assemblies 721 ✦ Finding
types 725 ✦ Creating instances of types 727 ✦ Defining new
types with Add-Type 729 ✦ Working with generic types 739
17.2 PowerShell and the internet 740
Retrieving a web page 740 ✦ Processing an RSS feed 742
17.3 PowerShell and graphical user interfaces 743
PowerShell and WinForms 744 ✦ Creating a winforms
module 750
PowerShell and Windows Presentation Foundation 753
17.4 Summary 759
18 Working with COM 760
18.1 Working with COM in PowerShell 761
Creating COM objects 761 ✦ Identifying and locating COM
classes 762
18.2 Automating Windows with COM 764
Exploring with the Shell.Application class 765 ✦ Managing
browser windows using COM 767 ✦ A browser window
management module 770
18.3 Working with the WScript.Shell class 777
18.4 Using COM to manage applications 779
Looking up a word using Internet Explorer 779 ✦ Using
Microsoft Word to do spell checking 781
18.5 The WSH ScriptControl class 783
Embedding VBScript code in a PowerShell script 784
Embedding JScript code in a PowerShell script 785
18.6 Working with the Windows Task Scheduler 786
Getting started with the Schedule.Service class 786 ✦ Listing
running tasks 787 ✦ Creating a new scheduled task 788
Credentials and scheduled tasks 789 ✦ Viewing the life cycle
of a task 792
18.7 Issues with COM 793
64-bit vs. 32-bit issues 793 ✦ Threading model problems 793
Interop assemblies, wrappers, and typelibs 793
18.8 Summary 795
19 Management objects: WMI and WS-MAN 797
19.1 Working with WMI in PowerShell 798
Exploring WMI 798 ✦ The WMI infrastructure 799
CONTENTS xvii
19.2 The WMI cmdlets 801
The WMI cmdlet common parameters 802 ✦ The Get-WmiObject
cmdlet 804 ✦ The Set-WmiInstance cmdlet 813 ✦ The
Invoke-WmiMethod cmdlet 819 ✦ The Remove-WmiObject
cmdlet 822
19.3 The WMI object adapter 824
The WMI type accelerators 825 ✦ Putting modified WMI objects
back 828
19.4 Exploring WS-Man 830
The WS-Man cmdlets 831 ✦ Using Get-WSManInstance to
retrieve management data 832 ✦ Updating resources using
Set-WSManInstance 840 ✦ Invoking methods with
Invoke-WSManAction 841
19.5 Summary 845
20 Responding in real time with eventing 847
20.1 Foundations of event handling 848
20.2 Synchronous events 849
Synchronous eventing in GUIs 850 ✦ Delegates and
delegation 850
20.3 Asynchronous events 853
Subscriptions, registrations, and actions 854 ✦ The eventing
cmdlets 854
20.4 Working with asynchronous .NET events 855
Writing a timer event handler 856 ✦ Managing event
subscriptions 859
20.5 Asynchronous event handling with scriptblocks 860
Automatic variables in the event handler 860 ✦ Dynamic
modules and event handler state 862
20.6 Queued events and the Wait-Event cmdlet 863
20.7 Working with WMI events 866
WMI event basics 866 ✦ Class-based WMI event
registration 867 ✦ Query-based WMI event
registrations 871
20.8 Engine events 875
Predefined engine events 875 ✦ Generating events in functions
and scripts 876
20.9 Remoting and event forwarding 877
Handling remote EventLog events 879 ✦ Serialization issues with
remote events 880
20.10 How eventing works 882
xviii CONTENTS
20.11 Summary 885
21 Security, security, security 888
21.1 Introduction to security 889
What security is and what it isn’t 889 ✦ Security: perception and
reality 890
21.2 Security modeling 891
Introduction to threat modeling 891 ✦ Classifying threats using
the STRIDE model 892 ✦ Security basics: threats, assets, and
mitigations 893
21.3 Securing the PowerShell environment 897
Secure by default 897 ✦ Enabling scripting with execution
policy 898
21.4 Signing scripts 904
How public key encryption and one-way hashing work 904
Signing authorities and certificates 905 ✦ Self-signed
certificates 905 ✦ Using a certificate to sign a script 909
Enabling strong private key protection 913 ✦ Using the PFX file
to sign a file 915
21.5 Writing secure scripts 916
21.6 Using the SecureString class 916
Creating a SecureString object 917 ✦ The SecureString
cmdlets 918 ✦ Working with credentials 919 ✦ Avoiding
Invoke-Expression 923
21.7 Summary 926
index 929
appendix A Comparing PowerShell to other languages
appendix B Examples
appendix C PowerShell Quick Reference
appendix D Additional PowerShell topics
Appendixes are available for download from
www.manning.com/WindowsPowerShellinActionSecondEdition
xix
preface
Well, it’s been a wild ride since the first edition of this book was released. At that
time, PowerShell had just shipped and had a fairly limited scope of influence. Things
have changed a lot. PowerShell now ships in the box with Windows (at least Win-
dows 7 and Server 2008 R2). The number of PowerShell users is now in the hundreds
of thousands, if not millions (this is not a formal estimate—I just looked at some of
the download counters for PowerShell-related tools and went from there).
One of the biggest events from my perspective was the release of PowerShell version
2 in July of 2009. Obviously it was time for a sequel to the book. I put together a short
proposal and estimate of the amount of work needed to update the book. The initial
estimate was for a few months of work—a couple of new chapters, a few updates here
and there, and we’re good to go. Wow, was I ever wrong about that! PowerShell v2
was a really big release.
When you are in the middle of something, working heads down, you tend to lose
perspective of the overall project—that old forest/trees problem. It wasn’t until I was
preparing a talk for MMS (Microsoft Management Summit) that I realized just how
BIG it was. In a one-hour talk, we barely had time to list all of the new stuff, much
less describe it in detail. But describing it in detail was exactly what I needed to do and
that’s why this book took a great deal longer to write than anticipated. It’s also much
bigger than I had expected or wanted. At one point it was double the size of the first
edition. So we cut some stuff that was no longer as relevant with PowerShell v2, moved
some stuff into the online appendixes, and capped the book at about 1000 pages.
So why write the book in the first place? The answer is the same now as it was
then—I wanted the PowerShell community to have a way to see “inside the box” and
have a more intimate insight into the goals and motivations behind PowerShell.
Although PowerShell draws heavily from existing technologies, it combines them in
剩余1015页未读,继续阅读
huzhouhzy
- 粉丝: 83
- 资源: 1949
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- AirKiss技术详解:无线传递信息与智能家居连接
- Hibernate主键生成策略详解
- 操作系统实验:位示图法管理磁盘空闲空间
- JSON详解:数据交换的主流格式
- Win7安装Ubuntu双系统详细指南
- FPGA内部结构与工作原理探索
- 信用评分模型解析:WOE、IV与ROC
- 使用LVS+Keepalived构建高可用负载均衡集群
- 微信小程序驱动餐饮与服装业创新转型:便捷管理与低成本优势
- 机器学习入门指南:从基础到进阶
- 解决Win7 IIS配置错误500.22与0x80070032
- SQL-DFS:优化HDFS小文件存储的解决方案
- Hadoop、Hbase、Spark环境部署与主机配置详解
- Kisso:加密会话Cookie实现的单点登录SSO
- OpenCV读取与拼接多幅图像教程
- QT实战:轻松生成与解析JSON数据
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功