Checking Input: Validation Attributes

Validation attributes check a parameter's value before any line of the function runs: [ValidateSet()] allows only a list of choices and makes Tab fill them in, [ValidateRange()] keeps a number between two limits, [ValidateNotNullOrEmpty()] turns away an empty value, and Mandatory asks for one that's missing.

Updated

Cheat sheet for the lesson Checking Input: Validation Attributes: Validation attributes check a parameter's value before any line of the function runs: [ValidateSet()] allows only a list of choices and makes Tab fill them in, [ValidateRange()] keeps a number between two limits…
Category
PowerShell
Level
Journeyman
Tags
mandatory-parameter, powershell, tab-completion, validaterange, validateset, validation-attribute