PowerShell Troubleshooting Guide

Minimize debugging time and maximize troubleshooting efficiency by leveraging the unique features of the PowerShell language
Preview in Mapt

PowerShell Troubleshooting Guide

Michael Shepard

1 customer reviews
Minimize debugging time and maximize troubleshooting efficiency by leveraging the unique features of the PowerShell language
Mapt Subscription
FREE
$29.99/m after trial
eBook
$12.60
RRP $17.99
Save 29%
Print + eBook
$29.99
RRP $29.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$12.60
$29.99
$29.99p/m after trial
RRP $17.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


PowerShell Troubleshooting Guide Book Cover
PowerShell Troubleshooting Guide
$ 17.99
$ 12.60
Instant Windows PowerShell Guide Book Cover
Instant Windows PowerShell Guide
$ 14.99
$ 10.50
Buy 2 for $23.10
Save $9.88
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781782173571
Paperback206 pages

Book Description

Windows PowerShell provides an amazing platform for administrative scripting and automation. Understanding the PowerShell language will enable you to spend less time troubleshooting and be more effective when debugging is required. PowerShell also includes several avenues to provide feedback from your code that will make your troubleshooting and debugging time more profitable.

Improved coding practices combined with useful diagnostic information can lead to results quickly. This book starts with background information on the purposes of automation and PowerShell's entrance into Microsoft's automation strategy, and also answers the question of whether scripting (and specifically PowerShell scripting) is essentially different than traditional programming. A brief overview of the main features of the PowerShell language along with examples is provided. Focus is placed on proper script design and use of PowerShell features in an attempt to reduce the need for troubleshooting.

Table of Contents

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
Further reading
Summary
Chapter 3: PowerShell Practices
Filter left
Format right
Comment-based help
Using Write-* cmdlets
Further reading
Summary
Chapter 4: PowerShell Professionalism
Naming conventions
Modularization
Version control
Unit testing
Further reading
Summary
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
Further reading
Summary
Chapter 6: Preparing the Scripting Environment
Validating operating system properties
Validating service status
Validating disk and memory availability
Validating network connectivity
Further reading
Summary
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
Further reading
Summary
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
Further reading
Summary

What You Will Learn

  • Utilize PowerShell output cmdlets to provide the troubleshooting information you need
  • Use pipeline input in your functions to reduce parameter passing issues
  • Use Write-* cmdlets to expose the right kind of information in the right places
  • Control the environment to eliminate surprises when executing scripts
  • Create powerful scripts and functions that communicate expectations
  • Write unit tests for your PowerShell functions and scripts to ensure that they can be executed correctly

Authors

Table of Contents

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
Further reading
Summary
Chapter 3: PowerShell Practices
Filter left
Format right
Comment-based help
Using Write-* cmdlets
Further reading
Summary
Chapter 4: PowerShell Professionalism
Naming conventions
Modularization
Version control
Unit testing
Further reading
Summary
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
Further reading
Summary
Chapter 6: Preparing the Scripting Environment
Validating operating system properties
Validating service status
Validating disk and memory availability
Validating network connectivity
Further reading
Summary
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
Further reading
Summary
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
Further reading
Summary

Book Details

ISBN 139781782173571
Paperback206 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Network Analysis using Wireshark Cookbook Book Cover
Network Analysis using Wireshark Cookbook
$ 29.99
$ 6.00
PowerShell 3.0 Advanced Administration Handbook Book Cover
PowerShell 3.0 Advanced Administration Handbook
$ 29.99
$ 21.00
Windows Server 2012 Automation with PowerShell Cookbook Book Cover
Windows Server 2012 Automation with PowerShell Cookbook
$ 32.99
$ 23.10
Mastering Windows PowerShell Scripting Book Cover
Mastering Windows PowerShell Scripting
$ 39.99
$ 28.00
Linux Shell Scripting Cookbook, Second Edition Book Cover
Linux Shell Scripting Cookbook, Second Edition
$ 26.99
$ 5.40
Mastering Windows Server 2016 Book Cover
Mastering Windows Server 2016
$ 47.99
$ 33.60