Home
> Powershell > [PS] Parameter with validation
[PS] Parameter with validation
Master powershell’s extensibility’s use of functions is key real life application of PS scripts. Parameters are primarily known as input functions, where information can be passed and validated. Below is an example of how of passing a parameter and setting static validation sets:
1 2 3 4 5 |
Param( [parameter(Mandatory=$true)] [ValidateSet("Low", "Average", "High")] [String[]]$Detail ) |
Reference: https://ss64.com/ps/syntax-args.html
Categories: Powershell
Comments (0)
Trackbacks (0)
Leave a comment
Trackback