Using Powershell "where" command to compare against Array of values
Try -notcontains
where ({ $ExcludeVerA -notcontains $_.Version })
so if I understand it corretly, then
$ExcludeVerA = "7", "3", "4"$java = Get-WmiObject -Class win32_product | where { $_.Name -like "*Java*"} |where ({ $ExcludeVerA -notcontains $_.Version })
That was direct answer to your question. Possible solution might be something like this:
$ExcludeVerA = "^(7|3|4)\."$java = Get-WmiObject -Class win32_product | where { $_.Name -like "*Java*"} | where { $_.Version -notmatch $ExcludeVerA}
it uses regex to get job done.
Try this:
Get-WmiObject -Class Win32_Product -Filter "Name LIKE '%Java%'" | Where-Object {$_.Version -notmatch '[734]'}