Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Last active June 7, 2019 10:51
Show Gist options
  • Save manualbashing/5a64445aec0574e5cef4 to your computer and use it in GitHub Desktop.
Save manualbashing/5a64445aec0574e5cef4 to your computer and use it in GitHub Desktop.
Function that checks and validates its parameters
Function Foo
{
Param(
[ValidateSet("Tom","Dick","Jane")]
[String]$Name,
[ValidateRange(21,65)]
[Int]$Age,
[ValidateScript({Test-Path $_ -PathType 'Container'})]
[string]$Path
)
# Do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment