WebJEA icon indicating copy to clipboard operation
WebJEA copied to clipboard

Variable ValidateSet

Open dwestness opened this issue 3 years ago • 1 comments

I would like to have a drop-down field that lists available values from a variable dataset

E.g. "Please Select an Active Directory Users:"

  • Drop-down list that shows all Active Directory Users (Derived from a "Get-ADUser" output)

I thought perhaps i could use the on-load script to run my Get-ADUser command and store the options in an array variable that could be passed to the actual script, but that doesn't work in any way.

The only thing i can think of at this point is to have the on-load script actually Edit/Modify the script itself to replace the validateset with my requirements, but that seems unrulely.

When i attempt something like this, the option is just presented as "$Users" (explicit string). Is there a way to Expand this into an actual list of User names?

[Parameter(Mandatory, HelpMessage='Select A User:')]
[ValidateSet($Users)]
[string]$User

dwestness avatar Aug 02 '21 13:08 dwestness

Dynamic parameters are not currently possible.

markdomansky avatar Aug 04 '21 23:08 markdomansky