Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PowerShell Troubleshooting Guide

You're reading from   PowerShell Troubleshooting Guide Minimize debugging time and maximize troubleshooting efficiency by leveraging the unique features of the PowerShell language

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781782173571
Length 206 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Shepard Michael Shepard
Author Profile Icon Michael Shepard
Michael Shepard
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. PowerShell Primer FREE CHAPTER 2. PowerShell Peculiarities 3. PowerShell Practices 4. PowerShell Professionalism 5. Proactive PowerShell 6. Preparing the Scripting Environment 7. Reactive Practices – Traditional Debugging 8. PowerShell Code Smells Index

Modularization


Writing a script to accomplish a task can be a daunting process. For those of us that are administrators without any programming background, it might not be straightforward to even know where to start.

For very simple tasks, it might be possible to write the entire script in a single line-by-line flow. While this is possible for the shortest tasks, as we get more comfortable with scripting we will definitely be applying PowerShell to more complex problems. Writing complex scripts in a simple start-to-finish way is bound to cause difficulties. In the following sections, we will give some basic instruction on how to go from an idea to a workable script. We will use the task of copying a production database down to a development server as an example.

Breaking a process into subtasks

The first step is to break the task down into subtasks or steps. A common way to do this is to use a comment statement (starting with the hash character, #) for each step. For our example, it might look...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image