One parameter may belong to several parameter sets. That means that you can use several methods of executing a cmdlet. Take Get-Process, for example; it allows for six different ways of execution.
A parameter can be mandatory in one parameter set, and optional in another. See the following code sample for one way of declaring your parameters:
function parametersets
{
param
(
[Parameter(ParameterSetName = 'Set1')]
$InSet1,
[Parameter(ParameterSetName = 'Set2')]
$InSet2,
$InAllSetsByDefault
)
}
Once a parameter of either set is specified, the other cannot be tab-completed or seen in IntelliSense any longer. Using all parameters yields a parameter binding exception.