I have written a C# Tool where i can enter script parameters with an GUI which is generated based on the parmeter definitions of the script.
Now i want to have a dropdown list which offers me a dynamically generated set of values. The informations for this dropdown list should come from the parameter definition of the script.
(In my case i want to select an existing AD OU by Listing all Child-Objects of the Base OU.)
One way to get a list of valid parameters is to use "ValidateSet" for Parameter definition. There is abway to get te ValidateSet from the Script an build the dropdown list. But ValidateSet is a static deffinition and i have to update the script each time the list should be changed.
A good way for dynamic validation is "ValidateScript". The script command would be something like Test-Path. This would work for validation, but for my GUI i would not be able to generate a list of valid values.
Maby i can dynamically generate a custom enum type and use it as parameter type. A dropdown list for enum types is already implemented for GUI. But i think i's not a good idea and may not work to generate a enum type dynamically.
So, any other ideas for a list of valid values which is dynamically built?