Throw is OK, I just wanted to be updated on the new ways of doing things. The
new parameter attribute-approcah seems so holistic and complete that I
suspected that Microsoft had introduced an "attribute-way" that replaced the
throw-technique, e.g. a [Parameter(Prompt=$false)] statement. Could not find
anything in the documentation, though...
BTW: I have already tried [ValidateNotNullOrEmpty()] in combination with
Mandatory and the prompt still appears. I believe validation takes place
after data is returned by the prompt.
Dio Genus
"Chris Dent" wrote:
>
> I haven't found a way.
>
> You could use [ValidateNotNullOrEmpty()], however that's implicit with
> Mandatory, and ineffective without (unless the parameter is actually
> supplied).
>
> Is throw so bad?
>
> Chris
>
> DioGenus wrote:
> > Is there a way to turn of this prompting for missing mandatory parameters and
> > instead throw an error (besides using a throw-statement as the parameter
> > default value)? Getting a prompt on the console is not very useful in batch
> > jobs.
> >
> > Dio Genus > .
>