vendredi 9 juin 2017

Powershell: if items in array1 contain items in array2, what am I doing wrong here

I am not sure what I am doing wrong here:

    $ZertoGenericAlert =  "VRA0030"
    $ZvmToVraConnection = "ZVM0002"
    $ZvmToZvmConnection = "ZVM0003", "ZVM0004"

  $thoseerrors = "ZVM0002", "VPG0006", "VPG0004" , "ZVM0003", "ZVM0004"

  if ($thoseerrors -contains $ZvmToZvmConnection) {Echo "bingo"} Else {Echo "fail"}

It keeps coming as "fail" when I run that that entire piece of code

It gives me "Bingo" when ONLY 1 item is found in the $zvmtozvmconnection

Ie I remove "ZVM0004" and only "ZVM003" remains i get "Bingo"

Please help

Aucun commentaire:

Enregistrer un commentaire