更新时间:2021-08-05 16:57:57
封面
版权页
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. PowerShell Primer
Introduction
Cmdlets
Functions
Scripts
Pipelines
Variables
Modules
Further reading
Summary
Chapter 2. PowerShell Peculiarities
PowerShell strings
Function output
Pipeline processing
PowerShell error handling
Chapter 3. PowerShell Practices
Filter left
Format right
Comment-based help
Using Write-* cmdlets
Chapter 4. PowerShell Professionalism
Naming conventions
Modularization
Version control
Unit testing
Chapter 5. Proactive PowerShell
Error handling
CmdletBinding()
SupportsShouldProcess
Parameter value validation
Pipeline input
Pipelines and function execution
Parameter type transformation
#REQUIRES statements
Set-StrictMode and Set-PSDebug -strict
Chapter 6. Preparing the Scripting Environment
Validating operating system properties
Validating service status
Validating disk and memory availability
Validating network connectivity
Chapter 7. Reactive Practices – Traditional Debugging
Reading error messages
Using Set-PSDebug
Debugging in the console
Debugging in the ISE
Event logs
The PSDiagnostics module
Using –confirm and –whatif
Reducing input set
Using Tee-Object to see intermediate results
Replacing the foreach loop with the foreach-object cmdlet
Chapter 8. PowerShell Code Smells
Code smells
Language-agnostic code smells
PowerShell-specific code smells
Missing Param() statements
Homegrown common parameters
Unapproved verbs
Accumulating output objects
Sequences of assignment statements
Using untyped or [object] parameters
Static analysis tools – ScriptCop and Script Analyzer
Index