In PowerShell, we can use the –contains operator to determine if a string contains something that we care looking for. Here is an example:
$collection = "One","Two","Three"
$collection -contains "One"
In this example, True would be returned. In the next example, True would also be returned.
$collection -contains "one"
The difference is the ‘O’ is lower case. This may not serve your needs if case sensitivity is a requirement. The below code will prove a case sensitive test.
$collection -ccontains "one"
Now the result will be False.
Comments