[ValidateScript({ If ($_ -gt10) { throw'You have submitted a value greater than 10. That will not work, dummy!' } Elseif ($_ -lt1) { throw'You have submitted a value lower than 1. That will not work, dummy!' }
PS C:\> $test2 = 11 You have submitted a value greater than 10. That will not work, dummy! At line:5 char:3 + { throw'You have submitted a value greater than 10. That will not work, dummy ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (You have submitted a...not work, dummy!:String ) [], RuntimeException + FullyQualifiedErrorId : You have submitted a value greater than 10. That will not work, dummy! PS C:\> $test2 = -2 You have submitted a value lower than 1. That will not work, dummy! At line:7 char:3 + { throw 'You have submitted a value lower than 1. That will not work, dummy ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (You have submitted a...not work, dummy!:String ) [], RuntimeException + FullyQualifiedErrorId : You have submitted a value lower than 1. That will not work, dummy!