I am trying to select the variable name from a selection of variables that is missing a value:
Only $fruit is missing "Pears" and I want to only list that.
$fruit = @('Apples','Oranges','Bananas')
$fruit2 = @('Apples','Oranges','Bananas', 'Pears')
$fruit3 = @('Apples','Oranges','Bananas', 'Pears')
So I need the code to find the variable name $fruit but I when I try this:
$fruit, $fruit2, $fruit3 | ?{$_ -notcontains "Pears"} | Select $_
It only lists the 3 fruits in the variable that does not contain "Pears"
How do I get it to list $fruit as the result?