I am writing a script and I want to specify the parameters to do the following:
Parameter 1 is action (either check or kill) Parameter 2 is computername.
If neither parameter is specified I want my Usage information displayed Parameter 2 should ONLY be prompted if Parameter 1 is specified.
Param(
[Parameter(Mandatory=$True,
HelpMessage="Please Enter an Action. (C)heck, (K)ill, or (?) for usage")]
[String]$Action,
[Parameter(Mandatory = $false,
Helpmessage="Please Enter One or More Hostnames. seperate multiple hostnames with an , EXAMPLE: Hostname1,Hostname2")]
[ValidateNotNullorEmpty()]
[String]$Computers
)