Description
What You Are Seeing?
Set-BoxStarterTaskbarOptions uses Parameter Sets to enforce mutually exclusive parameters e.g.:
[Parameter(ParameterSetName='AlwaysShowIconsOn')]
[switch]
$AlwaysShowIconsOn,
[Parameter(ParameterSetName='AlwaysShowIconsOff')]
[switch]
$AlwaysShowIconsOff,
[Parameter(ParameterSetName='MultiMonitorOff')]
[switch]
$MultiMonitorOff,
[Parameter(ParameterSetName='MultiMonitorOn')]
[switch]
$MultiMonitorOn,
However, Powershell enforces that the provided arguments MUST conform to a SINGLE parameter set, so for the above parameters you can't provide AlwaysShowIconsOn
AND MultiMonitorOff
in the same command because there's no ParameterSet that supports both values.
To resolve this, MultiMonitorOff
(and all other params) would need to include parameter set names allowing it to be included the other parameter sets e.g.
[Parameter(ParameterSetName='MultiMonitorOff')]
[Parameter(ParameterSetName='AlwaysShowIconsOn')]
[Parameter(ParameterSetName='AlwaysShowIconsOff')]
[switch]
$MultiMonitorOff,
Unfortunately, this makes it possible to provide conflicting values.
Long story short, it's not easy to enforce multiple mutually exclusive parameter sets in a powershell function. Better to just enforce it in the implementation.
Of note is the fact that the second example doesn't work for me.
What Is Expected?
Any set of valid arguments should be accepted.
How Did You Get This To Happen? (Steps to Reproduce)
Set-BoxstarterTaskbarOptions -Combine Never -AlwaysShowIconsOn -MultiMonitorOn -MultiMonitorMode All -MultiMonitorCombine Never
Output Log
Set-BoxstarterTaskbarOptions : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Set-BoxstarterTaskbarOptions -Combine Never -AlwaysShowIconsOn -Multi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-BoxstarterTaskbarOptions], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Set-BoxstarterTaskbarOptions