I cannot seem to figure out if this is possible or not. I want to validate the command line args if they are missing args print a pretty message.
For example
Param(
[Parameter(Mandatory=$True,HelpMessage="User Name must be specified.")]
[string]$userName
)
Now if I run my script from the command line, it still prints out this ugly red message at the bottom:
Missing an argument for parameter 'userName'. Specify a parameter of type 'System.String' and try again.
How do I get it to print HelpMessage
? Or better yet, call my own method with the missing param.