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…](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/4946cd2a551945399999444ab8e16b3d.webp)
- Category
- PowerShell
- Level
- Journeyman
- Tags
- mandatory-parameter, powershell, tab-completion, validaterange, validateset, validation-attribute