About This Book
- Reduce troubleshooting surprises by understanding the PowerShell language
- Avoid parameter passing mistakes by using PowerShell's unique pipeline binding capabilities
- Answer questions such as what, how, and why in troubleshooting sessions by utilizing PowerShell's various write- cmdlets
The techniques in this book apply to beginners who have just started to learn PowerShell, as well as advanced scripters who have a good grasp of the language.
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
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.
Chapter 2: PowerShell Peculiarities
Chapter 3: PowerShell Practices
Chapter 4: PowerShell Professionalism
Chapter 5: Proactive PowerShell
Chapter 6: Preparing the Scripting Environment
Chapter 7: Reactive Practices – Traditional Debugging
Chapter 8: PowerShell Code Smells