Parameter set to limit which parameters can be combined

suggest change
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 fails because -Silently and -Loudly belong to different parameter sets.
Do-Something -SomeThingToDo 'get-help about_Functions_Advanced' -Silently -Loudly

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents