Iwab0383e error validating parameters
Let us take a look at the previous example with parameter validation.
First of all, you replace over 10 lines of code with three markup tags!
Finally, if you ever want to make any modifications to the accepted parameter values, you would have to change those values in multiple places within the script.
Today, we will try to shed light on a feature that was introduced in Windows Power Shell 2.0: parameter validation.In Windows Power Shell 1.0, your code would look something like this: When executed, the end result appears to work perfectly, as shown here. First of all, you had to dedicate a chunk of the script to validating the value of each parameter.The validation is only as good as the script written to check it. These too, are only as good as written—and we all know how much we like to write good verbose messages.For instance, if you assign a default value to a parameter, that value will not be validated because only passed parameters are validated.This is shown in the following example: Intuition would imply that this code would throw an error if we attempt to use the default value—but remember, only user-supplied values are validated.