万本电子书0元读

万本电子书0元读

顶部广告

PowerShell Troubleshooting Guide电子书

售       价:¥

11人正在读 | 0人评论 9.8

作       者:Michael Shepard

出  版  社:Packt Publishing

出版时间:2014-11-28

字       数:70.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
The techniques in this book apply to beginners who have just started to learn PowerShell, as well as advanced *ers who have a good grasp of the language.
目录展开

PowerShell Troubleshooting Guide

Table of Contents

PowerShell Troubleshooting Guide

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Instant updates on new Packt books

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. PowerShell Primer

Introduction

Cmdlets

The big three cmdlets

Functions

Scripts

Pipelines

How pipelines change the game

What's the fuss about sorting?

Variables

Modules

Further reading

Summary

2. PowerShell Peculiarities

PowerShell strings

String substitution

How string substitution goes wrong

Escaping in PowerShell strings

Function output

Pipeline processing

PowerShell error handling

The trap statement

try, catch, and finally statements

Non-terminating errors

Further reading

Summary

3. PowerShell Practices

Filter left

Format right

Comment-based help

Using Write-* cmdlets

Write-Host

Output – the correct way

What about the other Write-* cmdlets?

Which Write should I use?

Write-Verbose

Write-Debug

Write-Warning

Write-Error

Write-Progress

Further reading

Summary

4. PowerShell Professionalism

Naming conventions

Cmdlet and function naming

Parameter naming

Module naming

Variable naming

Modularization

Breaking a process into subtasks

Helper functions

Single responsibility principle

Don't repeat code

Understanding the process

Version control

Using version control with PowerShell

Unit testing

Rolling your own unit tests

Why is PowerShell testing difficult?

An introduction to Pester

Mocking with Pester

Further reading

Summary

5. Proactive PowerShell

Error handling

Error-handling guidelines

Error-handling techniques

Investigating cmdlet error behavior

Catch and release

CmdletBinding()

Common parameter support

SupportsShouldProcess

Parameter name validation

Parameter value validation

Pipeline input

Pipelines and function execution

Parameter type transformation

#REQUIRES statements

Set-StrictMode and Set-PSDebug -strict

Further reading

Summary

6. Preparing the Scripting Environment

Validating operating system properties

Workstation/server version

Operating system version

Putting it all together

Validating service status

Validating disk and memory availability

Validating network connectivity

Using telnet

Using Test-NetConnection

Writing Test-NetConnection in downstream versions

Testing UDP and ICMP connectivity

Validating connectivity prior to implementation

Putting it all together

Further reading

Summary

7. Reactive Practices – Traditional Debugging

Reading error messages

The color problem

Changing console colors

Changing ISE colors

PowerShell profiles

Error message content

Using Set-PSDebug

Debugging in the console

Debugging in the ISE

Event logs

Listing event logs

Reading event logs

Writing to 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

Further reading

Summary

8. PowerShell Code Smells

Code smells

Code smells, best practices, antipatterns, and technical debt

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

ScriptCop

Script Analyzer

Further reading

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部