Created
September 21, 2018 15:39
-
-
Save shaneis/25e2398ff9aa0e99e0191cc81c84837f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-DefaultParameters { | |
[cmdletbinding()] | |
param( | |
[parameter(Position = 0)] | |
[ValidateScript({ Test-Path -Path $_ })] | |
[Alias('PSPath')] | |
[string] | |
$Path = (Read-Host -Prompt 'Enter the location of the folder'), | |
[parameter(Position = 1)] | |
[ValidateRange(1, 10)] | |
[Alias('RandomNumber')] | |
[int] | |
$Number = (Read-Host -Prompt 'Enter a number from 1 to 10'), | |
[parameter(Position = 2)] | |
[ValidateSet('Set1', 'Set2', 'Set3')] | |
[Alias('Option', 'Choose')] | |
[string] | |
$Set = (Read-Host -Prompt 'Choose a set of Set1, Set2, or Set3') | |
) | |
process { | |
[PSCustomObject]@{ | |
Path = $Path | |
Number = $Number | |
Set = $Set | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment