Skip to content

Variable ValidateSet #61

@dwestness

Description

@dwestness

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions