Dynamic Parameters/Store Parameter Definitions in Script


PowerShell param blocks provide an established syntax for defining parameters with robust type checking and validation.

The intention is to allow the storage of parameter definitions from the MaintenanceTaskParameter model in the database, to the script itself.

PowerShell even includes a Show-Command function that does this, so the functionality exists:

Show-Command Add-VpnConnection

This will only be supported for Tasks that use a “combined” script.


  • Wire up media selector for MediaAttribute parameters
  • Wire up key value form for Hashtable parameters
  • Wire up select
  • Wire up multi-select
  • Exclude parameters from being added to the powershell runspace that map to a $null value
  • Update session logic to use param blocks if the task uses param blocks
  • Update maintenance task form to auto refresh the parameter set on load and when the script is updated
  • throw proper errors in MediaAttribute
  • utilize triggered by in MediaAttribute to perform authorization on the media being requested
  • How do we handle zip folder ps variable in MediaAttribute?
  • Update onboarding form overrides to also use param blocks
  • add lots of tests
  • style the generated dynamic form like the current layout of the task parameter value form
  • don’t use a tab when there is only 1 parameter set
  • Figure out how to determine which parameter set will be the one used
    • After retrieving ShowCommandInfo, use the definition to build and run another function with parameters that executes $PsCmdlet.ParameterSetName which tells us which one it resolves to
  • add caching for retrieving parameter info
  • Figure out a way to not do this:
  • Add ability to migrate MaintenanceTaskParameters[] to a script param block
  • Add new column to maintenance task to store the script param block definition generated by maintenance task parameters (or generate it on the fly? seems wasteful)
  • Convert all existing deployment parameter values to new json string as part of a migration step when the backend starts up.