I am pretty new to Powershell and having trouble checking if a number in the pipeline exists in an array.
The last bit of this line "-or $_ -contains $percent" is the bit I am having trouble with.
I have tried various things but been unable to get it to work.
The script basically does a check to see if any of the values exist in output from all my tests and colour an area of a webpage accordingly.
I originally tried -le 10 but for some reason this also stopped -eq Enabled working.
I found the same with the 3 -eq LE entries when I tried -contains which is why I had to list them separately but I do not fancy doing this with 90 numbers.
I am sure I am just missing something stupid but spent 6+ hours on this so far and its driving me mad.
Thanks in advance.
$percent =(10..100)$rowData | % {
if ($_ -eq "success" -or $_ -eq "ok" -or $_ -eq "LE_40Users" -or $_ -eq "LE_1User" -or $_ -eq "LE_10Users" -or $_ -eq "Enabled" -or $_ -contains $percent)
}
You need to invert value in the
containscomparison: