How to Validate Parameter Input

This section contains examples that show how to validate parameter input by using various attributes to implement validation rules.

In This Section

How to Validate an Argument with a Script Describes how to validate an argument set by using the ArgumentSet attribute.

How to Validate an Argument Set Describes how to validate an argument set by using the ArgumentSet attribute.

How to Validate an Argument Range Describes how to validate an argument range by using the ArgumentRange attribute.

How to Validate an Argument Pattern Describes how to validate an argument pattern by using the ArgumentPattern attribute.

How to Validate the Argument Length Describes how to validate the length of an argument by using the ArgumentLength attribute.

How to Validate an Argument Count Describes how to validate an argument count by using the ArgumentCount attribute.

The way a parameter is declared can affect validation. For more information, see How to Declare Cmdlet Parameters.

Reference

See Also

Writing a Windows PowerShell Cmdlet