Contains, like, and match operators

The -contains, -like, and -match operators are very similar in function. While they all compare data, they all have their own purpose in your scripts. Each of these operators are case-insensitive. This means that when you are searching for items using these operators, they will match all instances of the value in the expression. In instances where you need the search to be case-specific, you can append c in front of the operator to force case sensitivity. These would look like –ccontains, -clike, and –cmatch. To force case insensitivity, you can also append i in front of the operator. These would look like –icontains, -ilike, and –imatch.

Each of these operators also has an inverse operator that is formed by ...

Get PowerShell: Automating Administrative Tasks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.