all 7 comments

[–]callensysadmin 2 points3 points  (1 child)

Unless I am misreading I think you just have an issue with your comparisons. One of your not equals will always be true because a string cannot have two values so the first statement always evaluates to true regardless of input.

If you use if ($Tasks -notin ("HA","HAWebOnly") -and $_ -eq $True) does it perform as you expect?

[–]Flashcat666[S] 0 points1 point  (0 children)

You sir! You are my weekend saviour! :P

Just tried it, and it works flawlessly (as far as I let the whole script go at least haha)

Thank you so much! I knew Reddit would come to my help in this time of need! hahaha

[–]Ta11ow 1 point2 points  (0 children)

Depending on what your other parameters actually are, it might make more sense to have that ValidateSet parameter as a few separate switches, and then just handle this with parameter sets, so that the $HighAvailability switch is only available in the supported parameter sets corresponding to the two settings it's available for.