I’m not sure how you’d pull it off from a UI perspective, but it’d be awesome if PSU could support parameter sets.
For example, I have a script with parameters defined like this:
# A numeric employee ID.
[Parameter(Mandatory, Position=0, ParameterSetName='id')]
[int] $Id,
# If specifying an ID, whether to include direct reports of that employee..
[Parameter(Position=1, ParameterSetName='id')]
[switch] $IncludeReports = $false,
# The date that employees were last modified.
[Parameter(ParameterSetName='since')]
[datetime] $Since = (get-date).Date,
[Parameter(ParameterSetName='start')]
[datetime]
$StartDate,
# The date that employees were last modified.
[Parameter(ParameterSetName='active')]
[switch] $Active
So you can specify -Id and optionally -IncludeReports, or -Active, or -Since and a date etc.
Perhaps the parameter parser could break these out into radio groups and let you just specify the parameters for the group whose radiobutton is selected? And honour the DefaultParameterSetName property so PSU knows which radio button to select by default.
I totally get how hard this would be to implement.
Nice! Tabs could work but to me they always feel like you have to fill out each tab, rather than each tab content being an option. Maybe a select with the parameter set names, and depending on which parameter set you select from the dropdown, the parameter fields underneath it change?
The nice thing about this is the fact that parameter sets can be named anything, so we can give them a nice human-readable name to appear in the dropdown. So instead of just “id” it can be “Employee ID”, and instead of “since” it could be “Modified On or After” etc.
Hey @adam did this ever get any traction? Still love the idea of being able to specify which parameter set I want to populate when executing a script. Doesn’t seem to have made it into 2.7.0 unless I’m doing something wrong.