lundi 27 novembre 2017

If statement - Four variables, only run if one true

I have the following which doesn't allow both variables to be enabled (boolean true value):

If (($Variable1) -and ($Variable2)) {
   Write-Warning "Both variables have been enabled. Modify script to enable just one."
   Pause
   Break
}

This works great, however, how would I ensure only one is ever enabled when 4 possible variables exist? I'm thinking a combination of -and & -or?

Aucun commentaire:

Enregistrer un commentaire