Book Image

Getting Started with Powershell

Book Image

Getting Started with Powershell

Overview of this book

Table of Contents (19 chapters)
Getting Started with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Next Steps
Index

Interpreting the cmdlet syntax


The syntax section of the cmdlet help can be overwhelming at first, so let's drill into it a bit and try to understand it in detail. I will use the get-service cmdlet for an example, but the principles are same for any cmdlet:

The first thing to notice is that there are three different get-service calls illustrated here. They correspond to the PowerShell concept of ParameterSets, but you can think of them as different use cases for the cmdlet. Each ParameterSet, or use case will have at least one unique parameter. In this case, the first includes the –Name parameter, the second includes –DisplayName, and the third has the –InputObject parameter.

Each ParameterSet lists the parameters that can be used in a particular scenario. The way the parameter is shown in the listing, tells you how the parameter can be used. For instance, [[-Name] <String[]>] means that the name parameter has the following attributes:

  • It is optional (because the whole definition is in...