Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function Test-Parameters {
[cmdletbinding()]
param(
[parameter(Mandatory, Position = 0, HelpMessage = 'Enter the location of the folder.')]
[ValidateScript({ Test-Path -Path $_ })]
[Alias('PSPath')]
[string]
$Path,
[parameter(Mandatory, Position = 1, HelpMessage = 'Enter a number from 1 to 10.')]
[ValidateRange(1, 10)]
[Alias('RandomNumber')]
[int]
$Number,
[parameter(Mandatory, Position = 2, HelpMessage = 'Choose a set of Set1, Set2, or Set3.')]
[ValidateSet('Set1', 'Set2', 'Set3')]
[Alias('Option', 'Choose')]
[string]
$Set
)
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