Defining parameter sets

A parameter set in PowerShell groups different parameters together. In some cases, this is used to change the output of a command; in others, it provides a different way of supplying a piece of information. For example, the output from the Get-Process command changes if the Module parameter or, to a lesser extent, the IncludeUserName parameter are supplied. The Get-ChildItem command also has two parameter sets: one that accepts a Path with wildcard support, and another that accepts a LiteralPath that does not support wildcards. That is, it has two different ways of supplying essentially the same information. Parameter sets are declared using the ParameterSetName property of the Parameter attribute. The following example ...

Get Mastering Windows PowerShell Scripting - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.