In PowerShell v2, I\'m trying to add only unique values to an array. I\'ve tried using an if statement that says, roughly, If (-not $Array -contains \'SomeValue\'), then ad
To fix your code, try -notcontains
or at least WRAP your contains-test in parantheses. Atm. your test reads:
If "NOT array"(if array doens't exist) contains word.
This makes no sense. What you want is:
If array does not contain word..
That's written like this:
If (-not ($IncorrectArray -contains $Word))
-notcontains
is even better, as @dugas suggested.