参数集用于限制参数的组合
Function Do-Something
{
Param
(
[Parameter(Mandatory=$true)]
[String]$SomeThingToDo,
[Parameter(ParameterSetName="Silently", mandatory=$false)]
[Switch]$Silently,
[Parameter(ParameterSetName="Loudly", mandatory=$false)]
[Switch]$Loudly
)
#Do something
}
# This will not work because you can not use the combination Silently and Loudly
Do-Something -SomeThingToDo 'get-help about_Functions_Advanced' -Silently -Loudly