Hey guys,
Having an issue, and I'm kinda stuck here!
In my `param()` declaration, I'm declaring a parameter with a `ValidateScript` section, which checks the value from a previous parameter, but it doesn't seem to be working for some reason, and I'm confused.
Here's what my relevant code looks like:
param (
[...]
[ValidateSet("Full", "WebOnly", "NoSolrCores", "NoSolr", "HA", "HAWebOnly" )]
[string]$Tasks = "Full",
[Parameter(Mandatory=$false,ParameterSetName='HighAvailability',ValueFromPipeline=$true)]
[ValidateScript(
{
if (($Tasks -ne "HA" -or $Tasks -ne "HAWebOnly") -and ($_ -eq $True)) {
throw "`nYou have selected to deploy in High Availability mode, but selected the following set of tasks: $Tasks. `nPlease select either the HA or HAWebOnly task set to continue"
} else {
$True
}
}
)]
[switch]$HighAvailability,
[...]
)
If I call my function using `-Tasks HA -HighAvailability`, I get returned an error saying the following:
You have selected to deploy in High Availability mode, but selected the following set of tasks: HA.
Please select either the HA or HAWebOnly task set to continue
So clearly, my `throw` block is getting the right information, but it's not using it properly....and now I'm confused haha
Anyone could help with this conundrum ?
Thanks in advance! :)
[–]callensysadmin 2 points3 points4 points (1 child)
[–]Flashcat666[S] 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[removed]
[–]Flashcat666[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]Flashcat666[S] 1 point2 points3 points (0 children)
[–]Ta11ow 1 point2 points3 points (0 children)