This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of ##Nick ##Nick 1 year, 5 months ago.

  • Author
  • #24939
    Profile photo of ##Nick

    I have a parameter property limiting end-user input to specifically allowed values.
    I've been tasked with using an appropriate method to dynamically create the allowed values based on directory names.
    (as a new directory is added the validate set should update, in the code below '2005-Std' is a directory)

    I've currently hard-coded the allowed inputs:

    function install-sql {
                [Parameter(Mandatory=$True,Position=1,HelpMessage= 'Please enter only the computer name you wish to install SQL to.')]
                [Parameter(Mandatory=$True,Position=2,HelpMessage= 'Please enter a SQL Version using the following syntax:
                YYYY-VER for example: ''2014-ENT''    Proper Versions (VER) are Ent = Enterprise, Dev = Developer, Std = Standard')]
                [ValidateSet["2005-Std", "2005-Ent", "2008-Std", "2008-Std-R2", "2008-Ent-R2", "2012-Std", "2012-Ent", "2012-Dev-x86", "2012-Dev-x64", "2014-Ent", "2014-Dev"]]

    I've done quite a bit of research but haven't found an easy to implement solution.
    I appreciate your taking a look at the desired functionality and providing some direction!

  • #24940
    Profile photo of ##Nick

    The PowerShell community is just awesome!
    For those interested in seeing the answer visit: [url][/url]

    Kudos to Martin Schvartzman for the excellent resource.

You must be logged in to reply to this topic.