Dynamic ValidateSet

Welcome Forums General PowerShell Q&A Dynamic ValidateSet

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
1 year, 1 month ago.

  • Author
    Posts
  • #85532

    Participant
    Points: 5
    Rank: Member

    Hi,

    I've created an advanced function which has a few parameters that required the ValidateSet to be dynamically populated.
    Is there a way to auto populate the set from another cmdlet?

    Thanks

    Tommy.

  • #85534

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    Kind of. What you're looking for is a Dynamic Parameter. Check out https://blogs.technet.microsoft.com/pstips/2014/06/09/dynamic-validateset-in-a-dynamic-parameter/. Alternately, you could write a ValidateScript instead, but that's not going to provide tab completion for permitted values.

The topic ‘Dynamic ValidateSet’ is closed to new replies.