Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Function Parameter Selectlist

$
0
0

When I use the function I would like it to get a dropdown list of "ValidationSet" after I typed in

"My-Function -Selected "

Function My-Function (
	[CmdletBinding()]
	[Parameter(Position=0, Mandatory=$true)]
    [ValidateSet("Default", "SomethingElse", "Custom")]
    $Selected = "Default"

	) {
	begin {
		switch ($Selected) {
			"Custom" { "code A" }"Default" {"Code B" }
		}
	}
}

My-Function -Selected "Custom"





Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>