Pro Windows PowerShell (eBook)
493 Seiten
Apress (Verlag)
978-1-4302-0546-3 (ISBN)
Here is your best companion to the capabilities and power that PowerShell offers. Inside this book, you'll discover the object-oriented features of the shell and how they help in extracting and manipulating data. You'll then learn how to use those features to solve real-world problems: manipulating files, working with text, monitoring systems, and performing operations over the network. In addition, you'll find freely available tools and extensions that help you get results with Windows PowerShell fast.
Hristo Deshev is a group product manager for Telerik, a leading vendor of ASP.NET controls (Telerik.com). He has been working on component development for the past several years, focusing on creating rich, highly interactive Ajax solutions. A major goal of his and his team is 'taming web development' applying agile software engineering practices to create robust solutions targeting all modern web browsers and supporting multiple ASP.NET and Visual Studio .NET versions. You can reach Hristo via e-mail at hristo.deshev@telerik.com and on his blog at http://blogs.telerik.com/blogs/twisted_asp_net.
Windows power users have always envied their friends running UNIX machines for the ease of automation that they enjoy. The traditional Windows command-line shell, cmd.exe, has never been up to par with shells like bash or tcsh, especially when it comes to text processing and process automation.Windows PowerShell changes all that. This next generation shell is also a full blown scripting environment with a real programming language that allows users to access every part of their operating system. Files, registry entries, and COM and .NET objects are all supported by PowerShell, which makes manipulating them a breeze. Pro Windows PowerShell will show you how to use all this power in your own work. You'll discover the object oriented features of the shell and how they help in extracting and manipulating data. You'll then learn how to use those features to solve real world problems: manipulating files, working with text, monitoring systems, and performing operations over the network. The book serves as not only a tutorial, but also a reference: the Real World part is structured so that it can be read nonlinearly and used as a reference or a cookbook. And you'll find freely available tools and extensions that will help you do things even faster.Pro Windows PowerShell is your best companion to the capabilities and power that PowerShell offers you.
Hristo Deshev is a group product manager for Telerik, a leading vendor of ASP.NET controls (Telerik.com). He has been working on component development for the past several years, focusing on creating rich, highly interactive Ajax solutions. A major goal of his and his team is "taming web development" applying agile software engineering practices to create robust solutions targeting all modern web browsers and supporting multiple ASP.NET and Visual Studio .NET versions. You can reach Hristo via e-mail at hristo.deshev@telerik.com and on his blog at http://blogs.telerik.com/blogs/twisted_asp_net.
Contents at a Glance 5
Contents 7
About the Author 16
About the Technical Reviewer 17
Acknowledgments 18
Introduction 19
Why Another Book on Windows PowerShell? 19
What’s in This Book? 19
Do I Need Prior Programming Experience? 20
Objects and Object Types 21
The Extended Type System 21
Built- in Types 28
Type Literals 45
Summary 51
Controlling Execution Flow 52
Conditional Expressions 52
Branching Instructions 63
Loops: Repeatedly Executing Blocks of Code 67
Summary 73
The Object Pipeline 74
Text-Based Pipelines 74
Object-Based Pipelines 75
Processing Collections Using ForEach- Object 78
Filtering Collections Using Where-Object 79
Adding or Deleting Properties Using Select-Object 79
Sorting Collections 81
Pipeline Tees 82
Grouping Objects 83
Gathering Collection Statistics 84
Detecting Changes and Differences Among Objects 84
The Object Pipeline and Functional Programming 85
Summary 86
Working with Script Blocks 87
Defining Script Blocks 87
Passing Parameters and Returning Values 89
Processing Pipeline Input 93
Invoking Strings as Expressions 101
Script Blocks as Delegates 103
Summary 104
Working with Functions 105
Defining Functions 105
Filters 115
Functions and Script Blocks 119
Summary 124
Command Aliases 125
Working with Aliases 125
Aliasing Tips, Techniques, and Pitfalls 133
Built- in Aliases 137
Summary 143
Providers 144
Enumerating Providers 144
Drives 146
Navigating to Drives 149
Provider Capabilities 151
Summary 154
Script Files 155
Creating Scripts 155
Executing PowerShell Scripts from Other Environments 164
Developing and Maintaining Script Libraries 165
Summary 170
Error Handling and Debugging 171
Handling Errors 171
Debugging Your Code 193
Summary 212
Signing Scripts 213
How Code Signing Works 213
Managing Certificates 215
Creating a Self- Signed Certificate 218
Signing Scripts 227
Running Scripts on Other Machines 231
Summary 233
The Shell Environment and Its Configuration 234
Shell Hosts 234
User Profile Scripts 238
Working with Saved Console Settings 241
Changing the Prompt Settings 243
Tab Expansion: How Command Completion Works 246
Summary 250
Extending the Type System 252
Modifying Objects and Types 252
Extending Object Formatting 262
Summary 267
Getting Help 268
The Help System 268
Getting Command Information 279
Getting Information About Objects 281
Using the Internet to Get Help 283
Summary 288
Taming Processes and Services 289
Working with Processes 289
Administering Services 295
Summary 298
Input and Output 299
Reading Content 299
Writing Content 302
Content Encoding 303
Extracting Data from Text 308
Summary 310
Monitoring Your System 311
Working with the Windows Event Log 311
Performance Counters 320
Summary 327
PowerShell and the World Wide Web 328
Laying the Foundation 328
Testing and Validating Web Sites 341
Working with News Feeds 345
Calling Web Services 351
Handling FTP Transactions 358
Summary 360
Sending E-mail 361
Using System. Net. Mail 361
Building a Reusable Script 362
Configuring Recipients 364
Working with Message Headers 367
Multipart Messages 369
Putting It All Together 375
Summary 377
Talking to COM Objects 378
How COM Works 379
How PowerShell Supports COM 379
Scripting Programs Through Their COM Interfaces 380
Windows Script Host Code Interoperability 400
Summary 404
Managing Windows with WMI 405
A Brief History of WMI 405
WBEM and WMI Components 406
PowerShell’s WMI Support 408
Language Support for WMI Objects 411
Exploring CIM Classes and Objects 414
Querying Hardware Devices 417
Getting Information About Software 418
The Network Configuration 421
Generating WMI Code 421
Summary 424
PowerShell Community Extensions 426
Installation and Configuration 426
File System Utilities 430
Network Utilities 434
Executing Processes and Commands 436
XML Tools 439
Working with Image Files 444
Clipboard Helpers 446
New Providers 449
Utility Applications 455
Summary 457
PSEventing: .NET Events in PowerShell 458
Introducing PSEventing 458
Event-Handling Mechanics 459
FileSystemWatcher: A Real- World Example 460
Monitoring Entries Written to the System Event Logs 461
Handling WMI Events 463
Detecting If Our Script Has Been Terminated by the User 465
Using Script Blocks As Event Handlers 466
Summary 468
Enhancing Tab Completion with PowerTab 469
Installation 470
How PowerTab Works 471
Configuring PowerTab 475
Summary 479
Index 480
Erscheint lt. Verlag | 6.4.2008 |
---|---|
Zusatzinfo | 493 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Netzwerke |
Mathematik / Informatik ► Informatik ► Software Entwicklung | |
Schlagworte | language • .NET • operating system • PowerShell • programming • Programming language • Registry • Scripting • UNIX • WINDOWS • Windows PowerShell |
ISBN-10 | 1-4302-0546-6 / 1430205466 |
ISBN-13 | 978-1-4302-0546-3 / 9781430205463 |
Haben Sie eine Frage zum Produkt? |
Größe: 10,4 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich