PowerShell in Depth - Don Jones, Jeffrey T. Hicks, Richard Siddaway

PowerShell in Depth

Buch | Softcover
744 Seiten
2014 | 2nd Revised edition
Manning Publications (Verlag)
978-1-61729-218-7 (ISBN)
56,60 inkl. MwSt
PowerShell in Depth, Second Edition is the go-to reference for administrators working with Windows PowerShell. Every major technique, technology, and tactic is carefully explained and demonstrated, providing a hands-on guide to almost everything an admin would do in the shell. Written by three experienced authors and PowerShell MVPs, this is the PowerShell book you'll keep next to your monitor—not on your bookshelf!
PowerShell is an automation engine for Windows systems. It is being built into all major Microsoft products and many third party products. PowerShell allows for the automations of day to day administration tasks and is a must learn technology for administrators.

Windows administrators will want this book open on their desk most of the time. With over 40 short chapters, each focused on a specific area of PowerShell, they'll be able to find answers fast. Each valuable technique was developed and thoroughly tested by seasoned PowerShell experts, so they'll be able to consistently produce production quality, maintainable scripts that will save countless hours of time and effort.

PowerShell in Depth, Second Edition is the go-to reference for administrators working with Windows PowerShell. Every major technique, technology, and tactic is carefully explained and demonstrated, providing a hands-on guide to almost everything an admin would do in the shell. Written by three experienced authors and PowerShell MVPs, this is the PowerShell book readers will keep next to their monitors-not on their bookshelf!
  • Provides in-depth coverage of PowerShell Written by acknowledged world class PowerShell experts
  • Shows how to solve real-world administrative problems
This book assumes readers know the basics of PowerShell.

Don Jones, Jeffery Hicks, and Richard Siddaway are Microsoft MVPs, trainers, and administrators. Collectively, they've authored nearly three dozen books on PowerShell and Windows administration.

Contents
preface
acknowledgments
about this book

Part 1 PowerShell fundamentals

Chapter 1 Introduction
Who this book is for
What this book will teach you
What this book won’t teach you
Where we drew the line
Beyond PowerShell
Ready?
Chapter 2 PowerShell hosts
32-bit vs. 64-bit, and administrator vs. not
The console
The PowerShell ISE
Command history buffer vs. PowerShell’s history
Transcripts
Summary
Chapter 3 Using the PowerShell help system
The help commands
Where’s the help?
Saving help
Using the help
“About” help files
Provider help
Interpreting command help
Common parameters
Summary
Chapter 4 The basics of PowerShell syntax
Commands
Parameters
Typing trick: line continuation
Parenthetical commands and expressions
Script blocks
Summary
Chapter 5 Working with PSSnapins and modules
There’s only one shell
PSSnapins vs. modules
Loading, autoloading, and profiles
Using extensions
Command name conflicts
Managing module autoloading
Summary
Chapter 6 Operators
Logical and comparison operators
Arithmetic operators
Other operators
Math operators
Summary
Chapter 7 Working with objects
Introduction to objects
Members: properties, methods, and events
Sorting objects
Selecting objects
Filtering objects
Grouping objects
Measuring objects
Enumerating objects
Importing, exporting, and converting objects
Comparing objects
Summary
Chapter 8 The PowerShell pipeline
How the pipeline works
Parameter binding ByValue
Pipeline binding ByPropertyName
Troubleshooting parameter binding
When parameter binding lets you down
Nested pipelines
The pipeline with external commands
Summary
Chapter 9 Formatting
The time to format
The formatting system
The Format cmdlets
Eliminating confusion and “gotchas”
Summary

Part 2 PowerShell management

Chapter 10 PowerShell Remoting
The many forms of remote control
Remoting overview
Using Remoting
PSSessions
Advanced session techniques
Creating a custom endpoint
Connecting to non-default endpoints
Enabling the “second hop”
Setting up WinRM listeners
Other configuration scenarios
Implicit Remoting
Standard troubleshooting methodology
Summary
Chapter 11 Background jobs and scheduling
Remoting-based jobs
WMI jobs
Scheduled jobs
Job processes
Summary
Chapter 12 Working with credentials
About credentials
Using credentials
Crazy credentials ideas
Summary
Chapter 13 Regular expressions
Basic regular expression syntax
The –match operator
The Select-String cmdlet
The Switch statement
The REGEX object
Subexpressions and named captures
Summary
Chapter 14 Working with HTML and XML data
Working with HTML
Using XML to persist data
XML basics
Reading XML files
Modifying XML
Creating XML
Select-XML
Summary
Chapter 15 PSDrives and PSProviders
Why use PSProviders?
What are PSProviders?
What are PSDrives?
Working with PSDrives
Transactional operations
Every drive is different
Summary
Chapter 16 Variables, arrays, hash tables, and script blocks
Variables
Built-in variables and the Variable: drive
Variable commands
Arrays
Hash tables and ordered hash tables
Script blocks
Summary
Chapter 17 PowerShell security
PowerShell security goals
PowerShell security mechanisms
Execution policy
Blocked files
The PowerShell security debate
Summary
Chapter 18 Advanced PowerShell syntax
Splatting
Defining default parameter values
Running external utilities
Expressions in quotes: $($cool)
Parentheticals as objects
Increasing the format enumeration limit
Hash tables as objects
Summary

Part 3 PowerShell scripting and automation

Chapter 19 PowerShell’s scripting language
Defining conditions
Loops: For, Do, While, Until
ForEach
Break and Continue
If . . . ElseIf . . . Else
Switch
Mastering the punctuation
Summary
Chapter 20 Basic scripts and functions
Script or function?
Execution lifecycle and scope
Starting point: a command
Accepting input
Creating output
“Filtering” scripts
Moving to a function
Filter construct
Summary
Chapter 21 Creating objects for output
Why output objects?
Syntax for creating custom objects
Complex objects: collections as properties
Applying a type name to custom objects
So, why bother?
Summary
Chapter 22 Scope
Understanding scope
Observing scope in action
Dot sourcing
Manipulating cross-scope elements
Being private
Being strict
Summary
Chapter 23 PowerShell workflows
Workflow overview
Workflow basics
General workflow design strategy
Example workflow scenario
Writing the workflow
Workflows vs. functions
Specific workflow techniques
Running a workflow
A practical example
Invoke-AsWorkflow
PSWorkflowSession
Troubleshooting a workflow
Summary
Chapter 24 Advanced syntax for scripts and functions
Starting point
Advanced parameters
Variations on parameter inputs
Parameter aliases
Parameter validation
Parameter sets
WhatIf and Confirm parameters
Verbose output
Summary
Chapter 25 Script modules and manifest modules
Making a script module
Exporting module members
Making a module manifest
Creating dynamic modules
Summary
Chapter 26 Custom formatting views
Object type names
Getting view templates
Starting a view file
Adding view types
Importing view data
Using named views
Going further
Summary
Chapter 27 Custom type extensions
What are type extensions?
Creating and loading a type extension file
Making type extensions
A complete example
Updating type data dynamically
Get-TypeData
Remove-TypeData
Summary
Chapter 28 Data language and internationalization
Internationalization basics
Adding a data section
Storing translated strings
Testing localization
Summary
Chapter 29 Writing help
Comment-based help
Writing About topics
XML-based help
Summary
Chapter 30 Error handling techniques
About errors and exceptions
Using $ErrorActionPreference and –ErrorAction
Using –ErrorVariable
Using $?
Using $Error
Trap constructs
Try...Catch...Finally constructs
Summary
Chapter 31 Debugging tools and techniques
Debugging: all about expectations
Write-Debug
Breakpoints
Using Set-PSDebug
Remote debugging
Debugging workflows
Debugging in third-party editors
Summary
Chapter 32 Functions that work like cmdlets
Defining the task
Building the command
Parameterizing the pipeline
Adding professional features
Error handling
Making it a function and adding help
Creating a custom view
Creating a type extension
Making a module manifest
Summary
Chapter 33 Tips and tricks for creating reports
What not to do
Working with HTML fragments and files
Sending email
Summary

Part 4 Advanced PowerShell

Chapter 34 Working with the Component Object Model (COM)
Introduction to COM objects
Instantiating COM objects in PowerShell
Accessing and using COM objects’ members
PowerShell and COM examples
Summary
Chapter 35 Working with .NET Framework objects
Classes, instances, and members
.NET Framework syntax in PowerShell
.NET support in PowerShell
Accessing static members
Finding the right framework bits
Creating and working with instances
Summary
Chapter 36 Accessing databases
Native SQL vs. OLEDB
Connecting to data sources
Querying data
Adding, changing, and deleting data
Calling stored procedures
A module to make it easier
Summary
Chapter 37 Proxy functions
The purpose of proxy functions
How proxy functions work
Creating a basic proxy function
Adding a parameter
Removing a parameter
Turning it into a function
Summary
Chapter 38 Building a GUI
WinForms via PowerShell Studio
Windows Presentation Foundation (WPF) and ShowUI
WinForms vs. WPF
Ideas for leveraging a GUI tool
Summary
Chapter 39 WMI and CIM
What is WMI?
WMI cmdlets
CIM cmdlets
CIM sessions
“Cmdlets over objects”
Summary
Chapter 40 Working with the web
Getting data from the web
Using web sessions
Working with web responses
Using REST services
Using SOAP web services
Just in case
Summary
Chapter 41 Desired State Configuration
What is DSC?
DSC architecture
Writing the configuration script
Getting the configuration to the computer
Creating and testing a DSC pull server
Writing DSC resources
DSC vs. Group Policy
Summary


appendix A Best practices
appendix B PowerShell Web Access
appendix C PowerShell versions
index

Preface Windows PowerShell is viewed by many IT professionals as a necessary evil, but we see it as a management marvel. The challenge from the beginning has been to wrap one’s head around the PowerShell paradigm of an object-based shell. Some people view PowerShell as just another scripting language like VBScript, but the truth is that Power- Shell is an automation and management engine. You can run this engine in a traditional console application, which is how most IT pros are first exposed to it. You can also run it in a graphical environment like the PowerShell Integrated Scripting Environment (ISE), or through a third-party tool like PowerGUI or PowerShell Plus. As you might imagine, the fourth version of a product offers substantially more features and benefits than the first, and PowerShell 4.0 fits this model. This version of PowerShell naturally builds on what came before, but it takes off from there. If you think of Windows 8.1 and Windows Server 2012 R2 as operating systems for the cloud, then PowerShell 4.0 is the automation and management engine for the cloud, although PowerShell “scales down” to help you better manage any size environment. Collectively, we have close to 70 years of IT experience. We have worked with PowerShell from its days as a beta product and have written on the topic for nearly as long. Our goal is to bring this knowledge and experience into a single reference book. Notice the key word, “reference.” This is not a how-to or teach yourself PowerShell book, although you can learn much from reading it cover to cover. Rather, this book is intended as the reference guide you keep at your desk or on your mobile device so that when you need to better understand a topic, like PowerShell remoting, you have a place to which you can turn. We have tried to keep our examples practical and targeted towards IT professionals responsible for Windows system administration. It is our hope that this will be the book you go to for answers.

Verlagsort New York
Sprache englisch
Maße 189 x 235 mm
Gewicht 1210 g
Einbandart kartoniert
Themenwelt Informatik Betriebssysteme / Server Windows Server
Mathematik / Informatik Informatik Netzwerke
Mathematik / Informatik Informatik Software Entwicklung
Schlagworte PowerShell • Windows Server
ISBN-10 1-61729-218-4 / 1617292184
ISBN-13 978-1-61729-218-7 / 9781617292187
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Das umfassende Handbuch für Administratoren

von Markus Widl

Buch | Hardcover (2022)
Rheinwerk (Verlag)
69,90