Book Image

Mastering Windows PowerShell Scripting

By : Brenton J.W. Blawat
Book Image

Mastering Windows PowerShell Scripting

By: Brenton J.W. Blawat

Overview of this book

Table of Contents (22 chapters)
Mastering Windows PowerShell Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


This chapter explored some of the fundamental components that are required for creating PowerShell scripts. These components include functions, loops, and switches. Each of these structures has a purpose within your scripts and can reduce the amount of effort in creating your scripts.

During this chapter, you explored how to create the structure of functions. You also learned how to feed arguments into these scripts and return values from a function.

The chapter also explained how you can create different types of looping structures. These looping structures include Do/Until, Do/While, ForEach, and For. The Do/Until loop was designed to execute until a variable equals a value. The Do/While loop will execute while a variable equals a value. The ForEach loop will execute for each object in an array. The final looping structure is For, which will execute for a set number of times as defined in the initial structure of the loop.

You went through the process of creating a Switch. You learned...