This was frustrating, but seems like a catch-22.
If $ErrorActionPreference is set to "SilentlyContinue" in a profile, before a script is run, parameter validation, like ValidateRange appears not to work when calling a script with an out of range parameter.
OK, that was clear as mud... Assume EA is set in profile and you run a script which has Parm1 restricted with [ValidateRange(1,5)], and you call it with Parm1=6.
The script appears not to run, but what really happens is that it fails validation, and the error message is suppressed. (That is what EA SilentlyContinue is supposed to do)
Any way of testing/setting EA before evaluating parameters?